Get last non zero value from a contiguous range of a column

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
In my worksheet, I have 2 contiguous ranges: A1:A10000 which generates numerical values in all cells. The generation of values in A1:A10000 can be divided in 2 parts
Part1: It generates numerical values >0 and is contiguous
Part2: It generates 0 (zero)
Example: If A1:A333 >0, then A334:A10000 =0 (zer0)

Output cell
F2=Fetch value from the cell from A1:A10000 which has generated LAST non zero value
Formula required for F2


Help provided would be highly appreciated. I am using Excel 2010.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Your formula works quite well. Thanks a lot aRandomHelper
 
Last edited by a moderator:
Upvote 0
If there could me multiple zeros in the range, then perhaps this:
=LOOKUP(2,1/(A:A<>0),A:A)
 
Upvote 0
If there could me multiple zeros in the range, then perhaps this:
=LOOKUP(2,1/(A:A<>0),A:A)
There WOULD BE multiple zeros in the Range A1:A10000. What I want to learn is: the difference in results of the 2 formula, please Scott
Formula by aRandomHelper
Excel Formula:
=INDEX(A:A,MATCH(0,A:A,0)-1)
Formula by you
Excel Formula:
=LOOKUP(2,1/(A:A<>0),A:A)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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