nested if

Giancar

Board Regular
Joined
Nov 29, 2017
Messages
52
Hi guys,

Not sure that title is correct, by the way I am stuck in one formula. Hopefully you can help.

This is the result I am looking for:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]week[/TD]
[TD]Month[/TD]
[TD]Month +1[/TD]
[TD]Month -1[/TD]
[TD]Forecast[/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]500[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD]0[/TD]
[TD]200[/TD]
[TD]201[/TD]
[TD]300[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]c[/TD]
[TD]100[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]101[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Basically in "Forecast column" I want the first value available between column "week" and "month-1" that is not 0.
Anyone able to help?
Thank you
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Assuming the intersection of "a" and "week" is the top left cell, "A1", Try:

Code:
=IF(A1<>0, A1, IF(B1<>0,B1,IF(C1<>0,C1,D1)))
 
Upvote 0
Another option which would save time and formula length if you add more columns:

=INDEX(A1:D1,MATCH(TRUE,INDEX(A1:D1<>0,),0))
 
Upvote 0
You don't need that second INDEX function.

=INDEX(A2:D2,MATCH(TRUE,A2:D2<>0,0))

Confirm with CTRL-SHIFT-ENTER rather than just Enter.
 
Last edited:
Upvote 0
Ah well, I found it that way and tested. Though it does save from having to CSE it. ;)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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