Find LATEST non-zero value in a row

vanderwel

New Member
Joined
Mar 16, 2015
Messages
4
Hello,

I am trying to figure out how to display the latest non-zero value in a row. Note, I am not looking for the last value (there is plenty of help here and else where on that) but the latest/most recent. Here is an example:

Source Data

<tbody>
</tbody>
19.5

<tbody>
</tbody>
149.1

<tbody>
</tbody>
0

<tbody>
</tbody>
0
23.4

<tbody>
</tbody>
0

<tbody>
</tbody>
0

<tbody>
</tbody>
0

<tbody>
</tbody>
Desired Outcome

<tbody>
</tbody>
19.5

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1

<tbody>
</tbody>

<tbody>
</tbody>
149.1
23.4

<tbody>
</tbody>
23.4

<tbody>
</tbody>
23.4

<tbody>
</tbody>
23.4

<tbody>
</tbody>
Attempt 1

<tbody>
</tbody>
19.5

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1
23.4

<tbody>
</tbody>
0

<tbody>
</tbody>

<tbody>
</tbody>
0

<tbody>
</tbody>
0

<tbody>
</tbody>
Attempt 2

<tbody>
</tbody>
19.5

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1
23.4

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1

<tbody>
</tbody>
149.1

<tbody>
</tbody>

<tbody>
</tbody>

In Attempt 1 I used the formula =IF(B1=0,OFFSET($B$1,0,(COUNT($B1:B1)-COUNTIF($B1:B1,0))-1),B1) dragging from left to right (so the COUNT ranges were increasing with each cell)

In Attempt 2 I used the formula = =IF(B1=0,INDEX($B1:B1,,MATCH(0,$B1:B1,0)-1),B1) again dragging from left to right.


Any ideas how I can achieve my desired outcome?

Thank you!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I'm not entirely sure what you are trying to do, but the below formula should match your desired outcome...

Excel Workbook
ABCDEFGHI
1Source Data19.5149.10023.4000
2Desired Outcome19.5149.1149.1149.123.423.423.423.4
3Formula19.5149.1149.1149.123.423.423.423.4
Sheet2
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

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