Find the month of the last non-zero value in a row

pliskers

Active Member
Joined
Sep 26, 2002
Messages
462
Office Version
  1. 2016
Platform
  1. Windows
I have a database with a header row containing month-year periods, and rows of data showing sales within each period. The dates move from earliest to latest as you go from left to right.

On each row, I need a formula to the right of column Z (assume the data fills columns A-Z) that will deliver the value in the date header row that corresponds to the last non-zero (>0) value within that row, between columns A and Z.

Any help will be much appreciated!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Sorry, it's just returning a zero. The formula needs to read the name of the month in row 1, and the formula needs to appear to the right of the last column of data in each row. That would put the formulas in column AA, and each should look at the values in that row up through column Z, and find the month in which the rightmost nonzero value occurs in that row.
 
Upvote 0
All values, some of which repeat themselves within a row
 
Upvote 0
Sorry, it's just returning a zero. The formula needs to read the name of the month in row 1, and the formula needs to appear to the right of the last column of data in each row. That would put the formulas in column AA, and each should look at the values in that row up through column Z, and find the month in which the rightmost nonzero value occurs in that row.

AA2, copy down:

=LOOKUP(9.99999999999999E+307,A2:Z2,$A$1:$Z$1)
 
Upvote 0
Uhoh, I just found a glitch. If a zero is in the rightmost column, it's evaluating it as a value. Only if I blank out the cell does it defer to the next cell with a value in it moving left. A zero should be evaluated the same way as if the cell were blank - the month needs to show the month with the last non zero value.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

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