Multiple IF statements

MrOllyR

New Member
Joined
Jun 24, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
I'm looking for some help with an IF statements:

Formula in cell D1:

If cell A1 contains "Example 1", return ""
If cell B1 contains any data, return its value
If cell A1 contains "Example 1" and cell B1 contains no data, return the value in C1

I've tried to nest these statements but I'm not even even close. Would anybody be able to help? Thank you in advance.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You're 1st & 3rd criteria seem to be at odds with each other.

Can you post some sample data along with expected results.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Your 1st and 3rd listings conflict with each other.
In order to come up with a good formula, we really need to know the output of each potential situation when BOTH criteria are considered.

So if we make a grid of the potential options, here is what I see.
ScenarioA1B1Desired Output
1​
"Example 1"Has Data
2​
"Example 1"No Datareturn C1
3​
No DataHas Data
4​
No DataNo Data
5​
Has Data other than "Example 1"Has Data
6​
Has Data other than "Example 1"No Data

Can you tell us the desired output for the other 5 options listed?
 
Upvote 0
Thank you for your replies. I think I've managed to work it out using this in D1 and it seems to work:

=IF(A1="Example 1","",IF(B1<>"",B1,IF(A1<>"Example 1",C1)))
 
Upvote 0
Solution
Glad you sorted it & thanks for the feedback.
 
Upvote 0
Thank you for your replies. I think I've managed to work it out using this in D1 and it seems to work:

=IF(A1="Example 1","",IF(B1<>"",B1,IF(A1<>"Example 1",C1)))
Since your have already checked to see in A1 is "Example 1", and the rest of your formula is in the FALSE clause of that check, you don't need to check it again.
So the formula you wrote can be simplified to this:
Excel Formula:
=IF(A1="Example 1","",IF(B1<>"",B1,C1))
 
Upvote 0
Since your have already checked to see in A1 is "Example 1", and the rest of your formula is in the FALSE clause of that check, you don't need to check it again.
So the formula you wrote can be simplified to this:
Excel Formula:
=IF(A1="Example 1","",IF(B1<>"",B1,C1))
Thank you, this is really useful!
 
Upvote 0
You are welcome.
I hope it makes sense why that extra check is not necessary (it is actually impossible to get to that point unless A1 is already not "Example1").
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,731
Members
449,093
Latest member
Mnur

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