Find Second Non-Zero Value In A Column

mlarson

Well-known Member
Joined
Aug 25, 2011
Messages
509
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I'd like to find the second non-zero value in a range (A13:A200) and have the output be in A9. So, in the example below, "Wilson, John" would be the output in A9. Hope this is easy. Thanks in advance!

0
0
0
Smith, Joe
0
0
Wilson, John
Jones, Sally
0
0
Johnson, Eric
0
Clark, Bill
0
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try

Book1
A
9Wilson, John
10
11
12
130
140
150
16Smith, Joe
170
180
19Wilson, John
20Jones, Sally
210
220
23Johnson, Eric
240
25Clark, Bill
260
27
2nd Value
Cell Formulas
RangeFormula
A9=INDEX(A13:A200,AGGREGATE(15,6,(ROW(A13:A200)-ROW(A13)+1)/(A13:A200<>0),2))
 
Upvote 0
Thank you. The "0" in cells is produced by a formula and that might be messing up the results. The formula provided seems to count Smith as 4th, Wilson as 7th, etc (so it's counting the 0's). Is there a way to rectify this while still keeping the formulas that produce the "0" cells (don't want to convert to values only).
 
Upvote 0
The "0" in cells ...
If the cells contain "0" rather than 0 then try making this modification

=INDEX(A13:A200,AGGREGATE(15,6,(ROW(A13:A200)-ROW(A13)+1)/(A13:A200<>"0"),2))
 
Upvote 0
I'm sorry, I should have been more clear. The cells contain 0, not "0"... any ideas on why the formula isn't working?
 
Upvote 0
Peter_SSs formula works for me, but if your interested in a VBA solution try
Code:
Sub NonZero()
   Range("A9").Value = Range("A13:A200").SpecialCells(xlFormulas, xlTextValues).Areas(2)(1)
End Sub
 
Upvote 0
Thanks, Fluff, but I'd love to do it as a formula in a cell instead of VBA. I'll rephrase the problem I'm encountering...
The 0 in cells is produced by a formula and that might be messing up the results. The formula provided seems to count Smith as 4th, Wilson as 7th, etc (so it's counting the 0's). Is there a way to rectify this while still keeping the formulas that produce the 0 cells (don't want to convert to values only).
 
Upvote 0
As Peter's formula worked for me, I'm not sure why it's not working for you.
Could you post the formula that you use in A13:A200?
 
Upvote 0
As Peter's formula worked for me, I'm not sure why it's not working for you.
Could you post the formula that you use in A13:A200?

Sure.
In A13... =IF(AND($F13="Yes",A$12>=$J13,A$12<=$K13),$D13,"0")
In A14... =IF(AND($F14="Yes",A$12>=$J14,A$12<=$K14),$D14,"0")
etc.
 
Upvote 0
Either remove the quotes from the 0 in your formula , or use the formula in post#4
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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