Confirm a value from a range

thebigbadbull55

New Member
Joined
Sep 11, 2018
Messages
7
Good Afternoon!

I am trying to figure out a way/formula option to take a range data set, confirm if a value is in that range, then display a value.

Zip StartZip EndTransit DaysPossible Zips
0423704241304237
0425204258304238
04239
04240
04241
04242
04243
04244
04245
04246
04247
04248
04249
04250
04251
04252
04253
04254

<tbody>
</tbody>


So with the data above, I am trying to determine in the values from column: Possible Zip are equal to or between the Zip Start and Zip End values, and if so, display the Transit Days value. I have about 8000 rows, so there is a lot of data to confirm and would need a formula that would be able to work for a large range.

I have had no luck with lookups, countifs, etc.


Any help on this would be extremely appreciated.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Well, you'll obviously want to make sure no one ever sorts your "possible" list. But anyhow, you would use =(match(destzip,possiblerange,0)-1)-match(orgzip,possiblerange,0)

If your columns started at column A it would look like this:
Code:
=(MATCH(B3,E:E,0)-1)-MATCH(A3,E:E,0)
 
Upvote 0
Thank you for the response!

This is on the right track, however it isn't exactly what I am looking for.

It might be that we have to add another function to this formula, so that we can confirm that the values in the possible zip range are actually between the values in the start and end zip ranges. Not sure how we can take the below formula down the possible zip list to confirm yes/no if the value exists in the range.



Well, you'll obviously want to make sure no one ever sorts your "possible" list. But anyhow, you would use =(match(destzip,possiblerange,0)-1)-match(orgzip,possiblerange,0)

If your columns started at column A it would look like this:
Code:
=(MATCH(B3,E:E,0)-1)-MATCH(A3,E:E,0)
 
Upvote 0
Here's a UDF is your interested.
Code:
Function ZipTransit(cl As Range, rng As Range)
   Dim i As Long
   ZipTransit = ""
   For i = 1 To rng.Rows.count
      If cl >= rng(i, 1) And cl <= rng(i, 2) Then
         ZipTransit = rng(i, 3)
         Exit For
      End If
   Next i
End Function


Excel 2013 32 bit
ABCDEF
1Zip StartZip EndTransit DaysPossible Zips
242374241442374
342524258342384
442394
542404
642414
74242
84243
94244
104245
114246
124247
134248
144249
154250
164251
1742523
1842533
1942543
Sheet2
Cell Formulas
RangeFormula
F2=ZipTransit(E2,A$2:C$3)
 
Upvote 0
Here's a UDF is your interested.
Code:
Function ZipTransit(cl As Range, rng As Range)
   Dim i As Long
   ZipTransit = ""
   For i = 1 To rng.Rows.count
      If cl >= rng(i, 1) And cl <= rng(i, 2) Then
         ZipTransit = rng(i, 3)
         Exit For
      End If
   Next i
End Function

Excel 2013 32 bit
ABCDEF
1Zip StartZip EndTransit DaysPossible Zips
242374241442374
342524258342384
442394
542404
642414
74242
84243
94244
104245
114246
124247
134248
144249
154250
164251
1742523
1842533
1942543

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
F2=ZipTransit([COLOR=rgb(255]E2,A$2:C$3[/COLOR])

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

After posting my solution, I was thinking that it doesn't work if the org zip code is further in the list than the dest zip. @Fluff does your UDF account for that.
Also sounds like bigbadbull wants a way to return "NO" if either org or dest zip don't match anything in the possible list.
 
Upvote 0
After posting my solution, I was thinking that it doesn't work if the org zip code is further in the list than the dest zip. @Fluff does your UDF account for that.
Not sure I understand.
The udf will check any zip code you feed into it, check if that occurs in any of the Start/end ranges & if so returns the transit time
 
Upvote 0
I was actually able to find a user guide online to get excel formatted to take the custom function!

Got it working!

this is perfect!!!

thank you very much for the help!!
 
Upvote 0

Forum statistics

Threads
1,215,593
Messages
6,125,716
Members
449,254
Latest member
Eva146

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