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

svendfj

Board Regular
Joined
Mar 19, 2011
Messages
76
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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,192
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
76
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,192

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
76
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:
 

Watch MrExcel Video

Forum statistics

Threads
1,109,383
Messages
5,528,377
Members
409,817
Latest member
JiNXX9500

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top