Finding Last non zero value in a column

ballan

New Member
Joined
Mar 4, 2003
Messages
48
I am stumped on this one and it may be quite simple. I have a column (lets say "B") of numbers that have non zero values followed by zero values. In a cell (lets say "C17") where "B17" and a variable number of cells above "B17" are zeros I would like to look upwards in Column "B" starting at "B17" to find the first non zero entry.
Any help would be appreciated.
 

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
Is this what you were looking for?
Book12
ABCD
1Data
24
33
454
52
65
734
8435
920
1021
1122
120
130
140
150
160
17022
Sheet1
 
Upvote 0
If you want the value then Seti's solution should work for you. Or do you want something else?
 
Upvote 0
It looks like you want the last non-zero value from a range. If so...
Book3
ABCD
1
29-4
38
48
5-1
60
79
88
9-4
100
11
Sheet1


The formula in C2 is:

=INDEX(A2:A10,MAX((ABS(A2:A10)>0)*ROW(A2:A10))-(CELL("Row",A2)-1))

which must be confirmed with control+shift+enter instead of just with enter.
 
Upvote 0
It works great! I was trying to figure out why it works, and I can't get a grip on it. Would you mind explaining the f(x)? Here's the formula that works:

=INDEX(A2:A10,MAX((ABS(A2:A10)>0)*ROW(A2:A10))-(CELL("Row",A2)-1))

TIA
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,391
Members
448,957
Latest member
Hat4Life

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