Finding the nth Value That Meets a Condition

apls2350

New Member
Joined
Aug 14, 2014
Messages
26
I've taken a formula from this article Excel: Finding the nth Value That Meets a Condition.

Which I'm trying to use to find the first non-empty cell in a range:

Example from article -


=INDEX(range,SMALL(IF(ISBLANK(range),"",ROW(range)),n)-ROW(range)+1)
</pre>
My version -


{=INDEX(V36:AB36,SMALL(IF(ISBLANK(V36:AB36),"",ROW(V36:AB36)),1)-ROW(V36:AB36)+1)}


But it's not returning the first value, which is located in cell AB36.

I think I'm using the second newest version of Excel (apologies for the vague description), which isn't listed as a compatible version in the article so perhaps the formula needs to be adapted?

I am entering the formula as an array..

Thanks in advance.

Thavethe nth Value That Meets a Condition
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi.

Try:

=INDEX($V$36:$AB$36,,AGGREGATE(15,6,(COLUMN($V$36:$AB$36)-MIN(COLUMN($V$36:$AB$36))+1)/($V$36:$AB$36<>""),ROWS($1:1)))

Copy down as required.

You will receive #NUM! errors in rows beyond the expected number of returns. These can be resolved to display anything you like if you wish. Let me know.

Regards
 
Upvote 0
Always better to word the problem you have instead of putting up a non-working formula.

Control+shift+enter, not just enter:

=INDEX($V$36:$AB$36,SMALL(IF(ISBLANK($V$36:$AB$36),"",COLUMN($V$36:$AB$36)-COLUMN($V$36)+1),1)
 
Upvote 0
You are working with a range that's a row not a column. Try:

=INDEX(V36:AB36,1,SMALL(IF(ISBLANK(V36:AB36),"",COLUMN(V36:AB36)),1)-COLUMN(V36:AB36)+1)

confirmed with ctrl+shift+enter
 
Upvote 0
Hi, thank you that's worked, that's a huge help. I'm not too worried about the #NUM!, which I haven't come across when applying this to other rows but how do I return a blank value, rather than #REF! when there isn't a 'matching' value in the row?

Regards
 
Upvote 0
You are working with a range that's a row not a column. Try:

=INDEX(V36:AB36,1,SMALL(IF(ISBLANK(V36:AB36),"",COLUMN(V36:AB36)),1)-COLUMN(V36:AB36)+1)

confirmed with ctrl+shift+enter

Although to be honest Jo's solution doesn't bring up the error message and is simpler to understand..

But when I copy the formula it doesn't return any values, even though the range is updated to cover the data that I'm trying to capture. What am I missing?

And if I need to find the second number in the range what does the formula need to be?
 
Last edited:
Upvote 0
My formula will return #NUM! too if all cells are blank. To avoid that use this:
Rich (BB code):
=IFERROR(INDEX(V36:AB36,1,SMALL(IF(ISBLANK(V36:AB36),"",COLUMN(V36:AB36)),1)-COLUMN(V36:AB36)+1),"")
confirmed with ctrl + shift + enter

If you want the second number try:

Rich (BB code):
=IFERROR(INDEX(V36:AB36,1,SMALL(IF(ISBLANK(V36:AB36),"",COLUMN(V36:AB36)),2)-COLUMN(V36:AB36)+1),"")

Either formula can be copied down a column to work on the corresponding cells in a row.
 
Last edited:
Upvote 0
Although to be honest Jo's solution doesn't bring up the error message and is simpler to understand..

But when I copy the formula it doesn't return any values, even though the range is updated to cover the data that I'm trying to capture. What am I missing?

And if I need to find the second number in the range what does the formula need to be?

If numbers, better invoke:

A2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($V$36:$AB$36,SMALL(IF(ISNUMBER($V$36:$AB$36),
  COLUMN($V$36:$AB$36)-COLUMN($V$36)+1),ROWS($A$2:A2))),"")
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top