Excel formula to look for a value corresponding to the first non-zero value in different row

wykh

New Member
Joined
Jul 9, 2009
Messages
1
Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec
8___8___8__8
________5__5__5
____________________________________2__2


For the above table, I am looking for a formula in Excel that will first look in each row for the first non-zero value, then return the month (in the top row, row 1) that corresponds to this first non-zero value in one of the rows below (row 2, 3, or 4). So for the first row, the formula will return Jan, March for the 2nd row, and Nov for the 3rd row.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Assuming no negative numbers.

Try this array formula** :

=IF(COUNTIF(A2:L2,">0"),INDEX(A$1:L$1,MATCH(TRUE,A2:L2>0,0)),"")

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.

Copy down as needed.
 
Upvote 0
Hello and welcome to the board,

try this
Excel Workbook
ABCDEFGHIJKLM
1JanFebMarAprMayJunJulAugSeptOctNovDec
28888Jan
3555Mar
422Nov
Sheet4
Cell Formulas
RangeFormula
M2=INDEX($A$1:$L$1,MATCH(TRUE,INDEX($A2:$L2<>0,0),0))
M3=INDEX($A$1:$L$1,MATCH(TRUE,INDEX($A3:$L3<>0,0),0))
M4=INDEX($A$1:$L$1,MATCH(TRUE,INDEX($A4:$L4<>0,0),0))
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,275
Members
449,093
Latest member
Vincent Khandagale

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