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
217
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)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,884
Office Version
  1. 2019
  2. 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
217
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
217

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
217
This works perfectly. I cannot believe how simple that was. Thank you

=C18&C21&G21&I21
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,282
Messages
5,836,410
Members
430,425
Latest member
xlsee

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