Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to determine the smallest index under a special condition?

In the following example:

          A     B
     1          bar
     2    3.0   foo
     3    4.0   foo
------------------------
     4    1.0   bar
------------------------
     5    2.0   bar
     6    5.0   bar 
     7          foo

I would like to get the smallest row index i (that is 4 in our case), for which B(i)="bar" and A(i) is not an empty cell. Could you please suggest a formula/VBA macro for this task?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

A nice and simple MINIFS should do what you want.

=MINIFS($A$2:$A$8,$B$2:$B$8,"<>",$C$2:$C$8,"bar")

enter image description here

This just return the minimum index where A is not blank, and B is "bar".

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading