If And with Multiple Conditions

Mr. Excel Wannabe

New Member
Joined
Mar 29, 2006
Messages
7
I am working on a spreadsheet where I need to identify whether an Uber has picked up at a Park & Ride or Amazon facility. The problem is both of these facilities are very large and have multiple lat/long coordinates. There are also thousands of other lat/long coordinates in my spreadsheet, so I am just looking for two narrow ranges of lat/long. If the lat/long doesn't match then I'd like to return a "--" instead of FALSE.

In the Pickup Address column, this is my formula: =IF(AND(U2>=30.417,U2<=30.42),IF(AND(V2<=-97.667,V2>=-97.669),"Park & Ride",IF(AND(U2>=30.429,U2<=30.434),IF(AND(V2<=-97.597,V2>=-97.601),"Amazon","--"))))

For some reason I am able to return the Park & Ride but not Amazon. Any help is very much appreciated!

Pickup AddressPickup LatitudePickup LongitudeDrop-off AddressDrop Off LatitudeDrop Off Longitude
FALSE​
30.448​
-97.63​
FALSE​
30.447​
-97.651​
FALSE​
30.467​
-97.621​
Park & Ride
30.419​
-97.668​
FALSE​
30.463​
-97.582​
FALSE​
30.439​
-97.619​
FALSE​
30.44​
-97.62​
FALSE​
30.463​
-97.582​
FALSE​
30.447​
-97.651​
FALSE​
30.448​
-97.63​
FALSE​
30.469​
-97.626​
FALSE​
30.435​
-97.647​
FALSE​
30.454​
-97.625​
FALSE​
30.431​
-97.598​
FALSE​
30.453​
-97.606​
FALSE​
30.454​
-97.625​
Park & Ride
30.419​
-97.669​
FALSE​
30.446​
-97.622​
FALSE​
30.432​
-97.6​
FALSE​
30.454​
-97.625​
FALSE​
30.441​
-97.606​
Park & Ride
30.419​
-97.669​
FALSE​
30.455​
-97.602​
Park & Ride
30.419​
-97.668​
FALSE​
30.422​
-97.56​
FALSE​
30.445​
-97.633​
FALSE​
0​
0​
FALSE​
0​
0​
FALSE​
0​
0​
FALSE​
0​
0​
Park & Ride
30.419​
-97.669​
FALSE​
30.44​
-97.623​
FALSE​
30.473​
-97.596​
FALSE​
30.469​
-97.626​
FALSE​
30.454​
-97.625​
FALSE​
30.431​
-97.598​
Park & Ride
30.419​
-97.669​
FALSE​
30.46​
-97.649​
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
The way your IFs are nested isn't quite right. You don't need two different IFs to check for long and lat, you do them all within the same AND.

Try this:

Excel Formula:
=IF(AND(U2>=30.417,U2<=30.42,V2<=-97.667,V2>=-97.669),"Park & Ride",IF(AND(U2>=30.429,U2<=30.434,V2<=-97.597,V2>=-97.601),"Amazon","--"))
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,727
Members
449,116
Latest member
Aaagu

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