If Formulas in A1 AND B1 both return a result then.. else do ....

Event2020

Board Regular
Joined
Jan 6, 2011
Messages
107
Office Version
  1. 2019
Platform
  1. Windows
I feel as if this is basis excel but for the life of me I can not get this to work, maybe early onset of old age.

Cells A1 and B1 pull data from a different work sheet.
Sometimes A1 will be the only formula to return a result but B1 will still contain a formula although it is not providing a result.

I need a formula can do as follows

IF the formuls in A1 **AND** B1 BOTH return a result then do "YES"
but is A1 has result but B1 DOES NOT then do "NO"

I have tried '
Excel Formula:
=IF(AND(A1="", B1=""),"NO","YES")

This returns a YES if A1 has a result but B1 does not but it also returns YES if A1 and B1 has a result.
It returns NO only if A1 and B1 have no result.

What am I doing wrong?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You did not mention what to return if B1 has a result, but A1 does not.

If you only want to return "YES" if BOTH A1 and B1 return a result, then use:
Excel Formula:
=IF(AND(A1<>"",B1<>""),"YES","NO")
or
Excel Formula:
=IF(OR(A1="",B1=""),"NO","YES")
 
Upvote 0
Hi Joe

Thank you for your reply and I apoligise for not fully explaining.

B1 will never have a result when A1 one does not.

It will always be:

A1 result and B1 Result or
A1 result and B1 No Result
 
Upvote 0
Both of the formulas I provided should work for you.

But if A1 will AWLAYS have a result, then you do not even need to check for that.
So you could simplify by just checking B1, i.e.
Excel Formula:
=IF(B1="","NO","YES")
or
Excel Formula:
=IF(B1<>"","YES","NO")
 
Upvote 0
Hi and thank you for your suggestions

I tried =IF(B1="","NO","YES") first but I really need A1 to be included.

I am afraid that none of your other suggestions work as expected.


=IF(OR(A1="",B1=""),"NO","YES")

this one produces

A1 Result B1 No Result = NO

A1 Result B1 Result = NO

A1 no result B1 no result = YES



=IF(B1<>"","YES","NO")

this one produces

A1 Result B1 No Result = YES

A1 Result B1 Result = YES

A1 no result B1 no result = NO



I need
A1 Result B1 No Result = YES
A1 Result B1 Result = NO

There will never be a senario where A1 & B1 will have no result, or A1 no result & B1 result
 
Upvote 0
Hi,

I'm afraid your description is contradictory, please review your requirements and re-state Exactly what your Logic is.

In your 1st post:

I need a formula can do as follows

IF the formuls in A1 **AND** B1 BOTH return a result then do "YES"
but is A1 has result but B1 DOES NOT then do "NO"

In your Last post (#5), you changed it the other way around:

I need
A1 Result B1 No Result = YES
A1 Result B1 Result = NO

There will never be a senario where A1 & B1 will have no result, or A1 no result & B1 result
 
Upvote 0
I explained it in my first post and since when did this forum become so snippy.

It does not matter which way around I place it as the result is the same
My logic is not flawed

It is being perceived as too difficult.

OK let me put it like this

A1 result B1 No result = Do something
A1 result B1 result = do something else
 
Upvote 0
I explained it in my first post and since when did this forum become so snippy.

It does not matter which way around I place it as the result is the same
My logic is not flawed

It is being perceived as too difficult.

OK let me put it like this

A1 result B1 No result = Do something
A1 result B1 result = do something else
Look who's talking.
Not trying to be Difficult, but trying to help you, just needed clarification, review Post #1 and Post #5, you did contradict youself.
Since Excel formulas, especially the one you're asking for requires Specific Logic, we needed to know what it is.

If All you want is If This, do This, otherwise, do that. Then
All of @Joe4 suggestions do that.
 
Upvote 0
There seems to be a bit of confusion here. I think the best thing to do is to lay out all possibilities, and you tell us your expected result for each one:
Scenario 1: A1 - RESULT, B1 - RESULT. What is your expected return value?
Scenario 2: A1 - RESULT, B1 - NO RESULT. What is your expected return value?
Scenario 3: A1 - NO RESULT, B1 - RESULT. What is your expected return value?
Scenario 4: A1 - NO RESULT, B1 - NO RESULT. What is your expected return value?

Also, I think there may be another factor that comes into play here. How are the values of A1 and B1 being populated?
Are they the results of formulas? If so, please post the formulas in these cells.
Note that if either of them returns a "space", that is NOT the same as "NO RESULT". A space is not treated the same as a blank or empty string in Excel. A space is something.
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

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