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

svendfj

Board Regular
Joined
Mar 19, 2011
Messages
88
Office Version
  1. 2016
Platform
  1. Windows
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
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:p> </o:p>
Note this is a simplified version.
<o:p> </o:p>
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.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
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:p> </o:p>
Note this is a simplified version.
<o:p> </o:p>
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
Joined
May 9, 2009
Messages
16,623
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
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:p></o:p>
Note this is a simplified version.
<o:p></o:p>
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
Joined
Mar 19, 2011
Messages
88
Office Version
  1. 2016
Platform
  1. Windows
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
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210

ADVERTISEMENT

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
Joined
May 9, 2009
Messages
16,623
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
Joined
Mar 19, 2011
Messages
88
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

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

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
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! :cool:
 
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,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.
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