If then statements - 3 variables

rraymond

New Member
Joined
May 26, 2011
Messages
17
What does an if/then statement look like that requires three variables to be met before an action can occur?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
There are a few approaches...depending on your needs.
Can you describe the criteria and what you want to happen when they are met...and not met?
 
Upvote 0
You can put AND as the criteria in IF


=IF(AND(a = b,c > d,e < f),Value if True, Value If False)<F),VALUE p if value true, false)<>

Hope that helps.
 
Upvote 0
This is the formula that I tried using, but it's not working:

=IF(AND('April 2011 Raw Data'!D:D="Northeast",'April 2011 Raw Data'!E:E="Acura",'April 2011 Raw Data'!F:F=1),IF(ISNA(MATCH(B2,'April 2011 Raw Data'!G:G)),0,INDEX('April 2011 Raw Data'!J:J,0)))

What I'm trying to do is get a numerical value, but the formula returned a FALSE. Huh? I need for the formula to match three variables in a row: Northeast, Acura, and a ranking (in this case 1), and then return a sales value.

In the formula above, the B2 cell reference is a dealer name, which will vary, which is why I need the formula to act upon a cell reference, not a set/unique identifier.
 
Upvote 0
An IF function won't be able to evaluate multiple rows of data like that - you need SUMPRODUCT, which doesn't accept entire columns as ranges. Something like the below:

Code:
=SUMPRODUCT(--('April 2011 Raw Data'!D2:D100="Northeast"),--('April 2011 Raw Data'!E2:E100="Acura"),--('April 2011 Raw Data'!F2:F100=1),--(2011 Raw Data'!G2:G100=B2),('April 2011 Raw Data'!J2:J100))
 
Upvote 0
I tried that sumproduct formula and it didn't work, even after re-working the ranges. Do I copy the whole thing, even with dashes? I've never used a sumproduct formula before.
 
Upvote 0
Yes - copy and paste the entire formula. You'll need to adjust the ranges if you have more than 100 rows of data.
 
Upvote 0
It's still not working. I can't understand this. I've tried permutations of half a dozen formulas. There has to be a solution here. I can get temporary solutions that work for this month, but which would still require manually data entry, altering dealer names for hundreds of rows each month.
 
Upvote 0
It returns a #NAME? error. How do I post a copy of my data so that it looks like a spreadsheet with rows/cells rather than just a mass of columns and text?
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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