Conditional display of either cell A or B contents in Cell C

svendfj

Board Regular
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
I had a working nested IF statement that I used to display text in Cell E1, based on the response (Yes or No) to 6 questions. The number of questions was subsequently raised to 8, exceeding the limit for nested IF statements. So I broke the if statement in two- there are nested IF statements in Cell D1 and Cell D2.
There are 3 possible outcomes:
1) Cell D1 has text
2) Cell D2 has text
3) Both Cell D1 and Cell D2 are empty.
I am trying to develop a formula that will – if Cell D1 or Cell D2 has text, will display that text in cell E1. (for either outcomes 1 or 2).
<o> </o>
Note this is a simplified version.
<o> </o>
Thanks,
David

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

MrExcel MVP
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
I had a working nested IF statement that I used to display text in Cell E1, based on the response (Yes or No) to 6 questions. The number of questions was subsequently raised to 8, exceeding the limit for nested IF statements. So I broke the if statement in two- there are nested IF statements in Cell D1 and Cell D2.
There are 3 possible outcomes:
1) Cell D1 has text
2) Cell D2 has text
3) Both Cell D1 and Cell D2 are empty.
I am trying to develop a formula that will – if Cell D1 or Cell D2 has text, will display that text in cell E1. (for either outcomes 1 or 2).
<o> </o>
Note this is a simplified version.
<o> </o>
Thanks,
David
If D1 and D2 both have text, say, FAD and KAD, what do you want to display in E1?

T. Valko

Well-known Member
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
I had a working nested IF statement that I used to display text in Cell E1, based on the response (Yes or No) to 6 questions. The number of questions was subsequently raised to 8, exceeding the limit for nested IF statements. So I broke the if statement in two- there are nested IF statements in Cell D1 and Cell D2.
There are 3 possible outcomes:
1) Cell D1 has text
2) Cell D2 has text
3) Both Cell D1 and Cell D2 are empty.
I am trying to develop a formula that will – if Cell D1 or Cell D2 has text, will display that text in cell E1. (for either outcomes 1 or 2).
<o></o>
Note this is a simplified version.
<o></o>
Thanks,
David
And what do you want to do for outcome 3?

Try this...

=IF(COUNTA(D1,D2),E1,"")

If both cells are empty then the formula returns a blank.

svendfj

Board Regular
Thank you very much!

The 3 possible outcomes are"
1) Text in Cell D1 --> display that text in Cell E1
2) Text in Cell D2 --> display that text in Cell E1
3) Both Cells D1 and D2 are empty --> do nothing

I would like to place a formula in Cell E1 that will display the text in whichever cell (D1 or D2) has text (case 1 or 2), or just stays empty for Case 3.

'=IF(COUNTA(D1,D2),E1,"")' placed in cell E1 gives a circular reference error, but I have tired variations of this with no luck.

Thanks again.

David

MrExcel MVP

Thank you very much!

The 3 possible outcomes are"
1) Text in Cell D1 --> display that text in Cell E1
2) Text in Cell D2 --> display that text in Cell E1
3) Both Cells D1 and D2 are empty --> do nothing

I would like to place a formula in Cell E1 that will display the text in whichever cell (D1 or D2) has text (case 1 or 2), or just stays empty for Case 3.

'=IF(COUNTA(D1,D2),E1,"")' placed in cell E1 gives a circular reference error, but I have tired variations of this with no luck.

Thanks again.

David

You did not answer the question what should happen in case both D1 and D2 have text. Maybe you just want:

E1:

=IF(D1<>"",D1,IF(D2<>"",D2,""))

T. Valko

Well-known Member
Thank you very much!

The 3 possible outcomes are"
1) Text in Cell D1 --> display that text in Cell E1
2) Text in Cell D2 --> display that text in Cell E1
3) Both Cells D1 and D2 are empty --> do nothing

I would like to place a formula in Cell E1 that will display the text in whichever cell (D1 or D2) has text (case 1 or 2), or just stays empty for Case 3.

'=IF(COUNTA(D1,D2),E1,"")' placed in cell E1 gives a circular reference error, but I have tired variations of this with no luck.

Thanks again.

David
OK, this should do what you want...

=IF(D1<>"",D1,IF(D2<>"",D2,""))

svendfj

Board Regular

Thanks! (There were only the 3 possible outcomes - the logic of all of the nested if statements provided that either D1 or D2 may have text, but not both.)

MrExcel MVP
Thanks! (There were only the 3 possible outcomes - the logic of all of the nested if statements provided that either D1 or D2 may have text, but not both.)

Great. Thanks for the feedback.

T. Valko

Well-known Member
Thanks! (There were only the 3 possible outcomes - the logic of all of the nested if statements provided that either D1 or D2 may have text, but not both.)
You're welcome. Thanks for the feedback!

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,302
Messages
5,836,498
Members
430,436
Latest member
fefenouil

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.

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