Find last zero value + 1 column and output from another row in the same column

HypnoHans

New Member
Joined
Jan 27, 2022
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I have some issues getting the output that I want in relation to the following example:

F G H I
Row 1: jan 22 feb 22 mar 22 apr 22

Row 200: 2 0 0 4


I need a formula capable of finding the last zero value within a range, + 1 column (so in the example above the result would be 4 (Cell I200). Then I need the formula to, based on the column of the value, output the value from Row 1 of the same column (in the example above the output would be apr 22 (Cell I1)).

Maybe it is a bit confusing, but I hope that you guys can help.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi HypnoHans,

You don't say what to do if there are no zeros or the last zero is in the last column so take a look at this and comment.

HypnoHans.xlsx
FGHIJK
1Jan-22Feb-22Mar-22Apr-22Last OneResult
20000Last One
31002Apr-22
40111Feb-22
51000Last One
62004Apr-22
71234No zeros
81023Mar-22
Sheet1
Cell Formulas
RangeFormula
G1:I1G1=EOMONTH(F1,0)+1
K2:K8K2=IFERROR(INDEX($F$1:$J$1,AGGREGATE(14,6,COLUMN($F$2:$I$2)-COLUMN($E$2)/($F2:$I2=0),1)+1),"No zeros")
 
Upvote 0
Solution
Hi HypnoHans,

You don't say what to do if there are no zeros or the last zero is in the last column so take a look at this and comment.

HypnoHans.xlsx
FGHIJK
1Jan-22Feb-22Mar-22Apr-22Last OneResult
20000Last One
31002Apr-22
40111Feb-22
51000Last One
62004Apr-22
71234No zeros
81023Mar-22
Sheet1
Cell Formulas
RangeFormula
G1:I1G1=EOMONTH(F1,0)+1
K2:K8K2=IFERROR(INDEX($F$1:$J$1,AGGREGATE(14,6,COLUMN($F$2:$I$2)-COLUMN($E$2)/($F2:$I2=0),1)+1),"No zeros")
Hi Toadstool,

It works - thank you!
 
Upvote 0
Hi @Toadstool

Quick question, which I hope that you can help clarify! ;)

Is it possible to do a formula that simply finds the first value that is < 0 in a range, and outputs the corresponding value from row 1 (Like in the example/solution above).

So for instance:

Feb-22Mar-22Apr-22
11-5-8
2-102-20

The output from the formula of row 1 should be: Mar-22
The output from the formula of row 2 should be: Feb-22

I hope that you can help.
 
Upvote 0
try this

Book1
ABCDEF
1Feb/22Mar/22Apr/22
211-5-8Mar/22
32-102-20Feb/22
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=INDEX($B$1:$D$1,MATCH(TRUE,B2:D2<0,0))
 
Upvote 0
@AlanY @Toadstool

Sorry... but I've got one more questions, which is simply can't figure out....

I need to find the first positive number after negative number(s) and output the corresponding value from the same column in row 1.

Example:

FGHIJ
1feb 22mar 22apr 22may 22jun 22
2105-55-2514

So in this example the output of the formula should be jun 22, as the first positive value, after a negative value is 14 (J2).

I hope that you can help.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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