Which formula to use if I need more than 7 arguments IF

rdvn915

New Member
Joined
Aug 2, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hello guys,

I have a cell in main Sheet in which I want a value from another cell from different Sheet. Because I can't use more than 7 IF in formula, I'm lost how to solve this issue.

If cell T22 from Sheet2 contains some value, use this value, but if is empty, use value of T21 from Sheet2,
if cell T21 from Sheet2 contains some value, use this value, but if is empty, use value of T20 from Sheet2,
if cell T20 from Sheet2 contains some value, use this value, but if is empty, use value of T19 from Sheet2,
etc. up to T1.

But it goes on, so if cell T1 from Sheet2 contains some value, use this value, but if is empty, use value of cell T20 from Sheet1.

To give you an idea of exactly what I mean, this is what the formula might look like if there could be more than 7 IF arguments.

Thank you in advance for your help.

=
IF(Sheet2!T22="",Sheet2!T21,Sheet2!T22),
IF(Sheet2!T21="",Sheet2!T20,Sheet2!T21),
IF(Sheet2!T20="",Sheet2!T19,Sheet2!T20),
IF(Sheet2!T19="",Sheet2!T18,Sheet2!T19),
IF(Sheet2!T18="",Sheet2!T17,Sheet2!T18),
IF(Sheet2!T17="",Sheet2!T16,Sheet2!T17),
IF(Sheet2!T16="",Sheet2!T15,Sheet2!T16),
IF(Sheet2!T15="",Sheet2!T14,Sheet2!T15),
IF(Sheet2!T14="",Sheet2!T13,Sheet2!T14),
IF(Sheet2!T13="",Sheet2!T12,Sheet2!T13),
IF(Sheet2!T12="",Sheet2!T11,Sheet2!T12),
IF(Sheet2!T11="",Sheet2!T10,Sheet2!T11),
IF(Sheet2!T10="",Sheet2!T9,Sheet2!T10),
IF(Sheet2!T9="",Sheet2!T8,Sheet2!T9),
IF(Sheet2!T8="",Sheet2!T7,Sheet2!T8),
IF(Sheet2!T7="",Sheet2!T6,Sheet2!T7),
IF(Sheet2!T6="",Sheet2!T5,Sheet2!T6),
IF(Sheet2!T5="",Sheet2!T4,Sheet2!T5,
IF(Sheet2!T4="",Sheet2!T3,Sheet2!T4),
IF(Sheet2!T3="",Sheet2!T2,Sheet2!T3),
IF(Sheet2!T2="",Sheet2!T1,Sheet2!T2),
IF(Sheet2!T1="",Sheet1!T20,Sheet2!T1))))))))))))))))))))))
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi & welcome to MrExcel.
You can use 64 levels of nesting, not 7.
That said do those cells contain a formula? If so what is it?
 
Upvote 0
Hello, thank you for the welcome.

There is no formula in those cells, those cells contains manually added values (numbers) - specifically closing price of stock.
I have a sheet for each month of the year in which there are closing price of stock for each day of the month.
And I want the closing price from the current day to be shown in a cell in the main sheet.
I manually write down these prices, which I don't mind, but I would like the current price to always be shown in the main sheet.

So basically, if I didn't enter today's price, I want yesterday's price to be shown in the cell.
 
Upvote 0
Try
Excel Formula:
=LOOKUP(9^9,Sheet2!T1:T22)
 
Upvote 0
Solution
Thank you! This is working well. I will just simply edit sheet name to show data from the current month.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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