IF statement formula

David_j78

New Member
Joined
Jun 18, 2021
Messages
12
Office Version
  1. 365
I am trying to write out an IF statement to that looks back through several cells checking if each is blank and going back to the next until I hit a cell with an amount it in.

I have been able to write it to check at least 3 cells back, but then I get stuck.

Formula I have so far is:
=IF(Sheet1!$AS7="",IF(Sheet1!$AP7="",Sheet1!$AM7,Sheet1!$AP7),Sheet1!$AS7)

Essentially I need to the formula to say if AS7 is blank, give me AP7. If AP7 is blank give me AM7, AM7 blank give me AJ7, so forth and so on.
My order of precedence is AS7, AP7, AM7, AJ7, AG7, AD7, AA7, X7, U7, R7, O7, L7, I7, and finally F7.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try an IFS so you can write them all as independent tests, but it stops at the first TRUE result. This will also let you easily change the order, add cells, or remove cells without having to deal with a massive nested IF.
Excel Formula:
=IFS(AS7<>"",AS7,AP7<>"",AP7,AM7<>"",AM7,AJ7<>"",AJ7,AG7<>"",AG7,AD7<>"",AD7,AA7<>"",AA7,X7<>"",X7,U7<>"",U7,R7<>"",R7,O7<>"",O7,L7<>"",L7,I7<>"",I7,F7<>"",F7,TRUE,"NO VALUES FOUND")
 
Upvote 0
Are you trying to return the first value you find searching in reverse order? Is there data in the cells between each target cell? What values are stored in the target cells?

Depending on your answers, you could use XLOOKUP.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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