If either field doesnt contain a value then enter text

creative999

Board Regular
Joined
Jul 7, 2021
Messages
98
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi

I need help with a formula to enter into C1.

If A1 AND B1 = NO, then C1 = NO.
If A1 OR B1 contains a value, then C1 = value from A1 or B1.

Thank you in advance.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What is A1 and B1 BOTH contain values?
Then what should cell C1 show?

And what exactly is in cells A1 and B1?
Are they numeric entries, date entries, or text entries?
 
Upvote 0
What do you mean by "a value"? Do you mean any value?

Here I am assuming that "has a value" means "not blank."

Excel Formula:
=IF(AND(A1="NO",B1="NO"),"NO",IF(A1<>"",A1,IF(B1<>"",B1,"")))

If A1 and B1 both have values, then it uses the A1 value.
If A1 and B1 are both blank, then the result is blank (you did not specify that case)
 
Upvote 0
What is A1 and B1 BOTH contain values?
Then what should cell C1 show?

And what exactly is in cells A1 and B1?
Are they numeric entries, date entries, or text entries?
The values (text) in A1 or B1 could be the same (other than "NO")
 
Upvote 0
What do you mean by "a value"? Do you mean any value?

Here I am assuming that "has a value" means "not blank."

Excel Formula:
=IF(AND(A1="NO",B1="NO"),"NO",IF(A1<>"",A1,IF(B1<>"",B1,"")))

If A1 and B1 both have values, then it uses the A1 value.
If A1 and B1 are both blank, then the result is blank (you did not specify that case)
A1 or B1 will never be blank. They will contain some text or be NO
 
Upvote 0
The values (text) in A1 or B1 could be the same (other than "NO")
That really doesn't answer my question.

Is it possible that BOTH A1 and B1 could both have values?
If so, is it possible that they could have DIFFERENT values?
If cell A1 and B1 both have values, and they are different, what exactly do you want returned in cell C1?
Do you want the combined values, or a certain one?

For example, what if A1 has "Cat" and B1 has "Dog".
What then exactly do you want to see in cell C1 in that case?
 
Upvote 0
That really doesn't answer my question.

Is it possible that BOTH A1 and B1 could both have values?
If so, is it possible that they could have DIFFERENT values?
If cell A1 and B1 both have values, and they are different, what exactly do you want returned in cell C1?
Do you want the combined values, or a certain one?

For example, what if A1 has "Cat" and B1 has "Dog".
What then exactly do you want to see in cell C1 in that case?
Assumption is that a1 and b1 won’t have different values. However, for the rare exception that they do, c1 should combine the values.
Hope that helps.
 
Upvote 0
OK, I think this formula should cover ALL your possibilities:
Excel Formula:
=IF(AND(A1="NO",B1="NO"),"NO",IF(AND(A1<>"",B1<>"",A1<>B1),A1&B1,IF(A1<>"",A1,IF(B1<>"",B1,""))))
 
Upvote 1
Solution

Forum statistics

Threads
1,221,590
Messages
6,160,657
Members
451,662
Latest member
reelspike

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
Back
Top