Using IF, AND, OR formula

Jewells0905

New Member
Joined
Mar 10, 2024
Messages
29
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello All,

I am trying to write a formula to make an interactive spreadsheet to select cars based on three criteria:

  1. Origin. In cells B1:D1 the user enters one or more regions of interest, including "US", "Europe", and "Japan", not necessarily in this order, either all three or just some of them, one name per cell.
  2. Maximum weight. In cell B2, the user enters the maximum allowed car weight in pounds.
  3. Maximum number of cylinders. The user enters the maximum allowed number of cylinders in cell B3.
The three criteria must be met simultaneously for a car to be selected. If a car is selected, its name from column A should appear in the same row in column J.

Now my issue is that I am not able to get the formula to work for column J. I may just not have it in the correct order, or something simple, but I am needing to use IF, AND as well as OR for this formula. Below is what I have thus far.
=IF(AND(OR(B1,B2,B3),A7,)(I7=B1,C1,D1))
Origin(s):USEuropeJapan
Max weight:3500
Max cylinders:6
Total:1
CarMPGCylindersDisplacementHorsepowerWeightAccelerationModelOriginSelection
Chevrolet Chevelle Malibu18830713035041270US#N/A
Buick Skylark 320158350165369311.570US
Plymouth Satellite18831815034361170US
AMC Rebel SST16830415034331270US
Ford Torino178302140344910.570US
Ford Galaxie 50015842919843411070US
Chevrolet Impala1484542204354970US
Plymouth Fury iii14844021543128.570US
Pontiac Catalina14845522544251070US
AMC Ambassador DPL15839019038508.570US
Citroen DS-21 Pallas04133115309017.570Europe
Chevrolet Chevelle Concours (sw)08350165414211.570US
Ford Torino (sw)0835115340341170US
Plymouth Satellite (sw)08383175416610.570US
AMC Rebel SST (sw)0836017538501170US
Dodge Challenger SE15838317035631070US
Plymouth 'Cuda 3401483401603609870US
Ford Mustang Boss 302083021403353870US
Chevrolet Monte Carlo15840015037619.570US
Buick Estate Wagon (sw)14845522530861070US
Toyota Corolla Mark ii2441139523721570Japan

Thank you
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Perhaps this:
Book1
ABCDEFGHIJ
1Origin(s):USEuropeJapan
2Max weight:3500
3Max cylinders:6
4Total:1
5
6CarMPGCylindersDisplacementHorsepowerWeightAccelerationModelOriginSelection
7Chevrolet Chevelle Malibu18830713035041270US 
8Buick Skylark 320158350165369311.570US 
9Plymouth Satellite18831815034361170US 
10AMC Rebel SST16830415034331270US 
11Ford Torino178302140344910.570US 
12Ford Galaxie 50015842919843411070US 
13Chevrolet Impala1484542204354970US 
14Plymouth Fury iii14844021543128.570US 
15Pontiac Catalina14845522544251070US 
16AMC Ambassador DPL15839019038508.570US 
17Citroen DS-21 Pallas04133115309017.570EuropeCitroen DS-21 Pallas
18Chevrolet Chevelle Concours (sw)08350165414211.570US 
19Ford Torino (sw)0835115340341170US 
20Plymouth Satellite (sw)08383175416610.570US 
21AMC Rebel SST (sw)0836017538501170US 
22Dodge Challenger SE15838317035631070US 
23Plymouth 'Cuda 3401483401603609870US 
24Ford Mustang Boss 302083021403353870US 
25Chevrolet Monte Carlo15840015037619.570US 
26Buick Estate Wagon (sw)14845522530861070US 
27Toyota Corolla Mark ii2441139523721570JapanToyota Corolla Mark ii
Sheet4
Cell Formulas
RangeFormula
J7:J27J7=IF(AND(ISNUMBER(MATCH(I7,$B$1:$D$1,0)),F7<=$B$2,C7<=$B$3),A7,"")
 
Upvote 0
=IF(AND(ISNUMBER(MATCH(I7,$B$1:$D$1,0)),F7<=$B$2,C7<=$B$3),A7,"")
Hi, Thank you so much for your response, while that is not giving me an error, it's also not giving me the correct calculations. With the current info, it should be giving me 281 cars, but it's showing 406 cars that match that criteria. Also I have to use the IF, AND as well as OR for this. This is for a class I'm taking to learn data analysis, so it's required to use these 3 functions. I have been trying to figure this out for hours. I feel like I'm losing my mind over here! HAHA
 
Upvote 0
Well, not trying to do your homework for you, but this solves the OR problem.. though I'm not sure what the other issue is. I tested on the data provided and as far as I can tell, it works as intended.

Excel Formula:
=IF(AND(OR(I7=$B$1,I7=$C$1,I7=$D$1),F7<=$B$2,C7<=$B$3),A7,"")
 
Upvote 0
Solution
Oh my gosh, you are a formula genius! Thank you so much I have been fussing with this for hours, and of course after seeing your solution, it makes perfect sense. Now I can move onto the next step. Thank you again for your help.
 
Upvote 0
Oh my gosh, you are a formula genius! Thank you so much I have been fussing with this for hours, and of course after seeing your solution, it makes perfect sense. Now I can move onto the next step. Thank you again for your help.
You're welcome.
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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