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

#### Craigc3814

##### Board Regular
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
Give this formula a try...

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

#### Craigc3814

##### Board Regular
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
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

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

=C18&C21&G21&I21

#### MarcelBeug

##### Well-known Member
You're welcome.

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.

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.

### Which adblocker are you using?

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

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