If a cell is blank give return this cell, if that cell is also blank return this cell

Craigc3814

Board Regular
Joined
Mar 7, 2016
Messages
212
If cell C18 has a value return me that value if it is blank return me cell 21 but if cell c21 doesn't have a value return me cell e21, if that is also blank return me I21.

Here are the 3 formulas I have been trying and they all only work in certain instances.

=IF(ISBLANK(C18),IF(ISBLANK(C21),IF(ISBLANK(E21),I21,E21),C21),C18)

=IFERROR(1/(1/C18),IF(ISBLANK(C18),C21,IF(ISBLANK(E21),I21,E21)))

=IF(C18=" ",C21,IF(C21=" ",E21,IF(E21=" ",I21,IF(I21=" ","Not Selected",C18)*C21)*E21)*I21)
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,722
Office Version
  1. 2010
Platform
  1. Windows
Give this formula a try...

=IF(C18="",IF(C21="",IF(E21="",I21,E21),C21),C18)
 

Craigc3814

Board Regular
Joined
Mar 7, 2016
Messages
212
It is only working if there is a value in C18 if I move a value to C21, E21, or I21 it is returning nothing. I thought there should be an AND statement included but cant figure it out
 

MarcelBeug

Well-known Member
Joined
Apr 25, 2014
Messages
1,811
This may be easier to read:
Code:
=IF(C18<>"",C18,IF(C21<>"",C21,IF(E21<>"",E21,I21)))
But it returns the same result as Rick's; both are 1:1 codings to Excel from your definition (with small correction in red):
"If cell C18 has a value return me that value if it is blank return me cell c21 but if cell c21 doesn't have a value return me cell e21, if that is also blank return me I21."

So if the result is not ok, then your definition is not ok either.

Edit: do you mean with "move a value" that you are dragging C18 to e.g. C21? That might result in #REF! errors in the formula and/or in the result.
 
Last edited:

Craigc3814

Board Regular
Joined
Mar 7, 2016
Messages
212

ADVERTISEMENT

Yea, I think I am not explaining it correctly. Cell c18,c21,g21, or cell i21 SHOULD always have 1 value. Meaning that if there is a value in cell c18 the other cells are blank. If there is a value in cell e21 the other cells should be blank. So when there is a value in cell c18 stop right there and give me that value. If there is a value in cell e21 and cell c18 and d21 are blank stop right there and return to me what is in cell E21.

Does that help? I feel like it should be a fairly easy formula I am just doing a poor job at explaining it
 

MarcelBeug

Well-known Member
Joined
Apr 25, 2014
Messages
1,811
Try
Code:
=C18&C21&G21&I21
Or, if values are numeric
Code:
=SUM(C18,C21,G21,I21)
Not clear if you mean G21 or E21.
 

Craigc3814

Board Regular
Joined
Mar 7, 2016
Messages
212
This works perfectly. I cannot believe how simple that was. Thank you

=C18&C21&G21&I21
 

Watch MrExcel Video

Forum statistics

Threads
1,123,494
Messages
5,602,004
Members
414,490
Latest member
Rip181

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
Top