Looking up a state based on a zipcode.

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
The end was cut off of the url. Add "html" (without the quotes) to the end of that link and it should be fine. I'll edit the post to fix it.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
termeric

I copied the data into columns A-E and then used this formula.

=INDEX(B1:B73,MATCH(F1, C1:C73,0),1)

Note I had to use Data>Text to columns... on column C to remove trailing spaces.
 

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
for VB try this

Code:
Sub StateZip()
' to lookup zip based on zip code
Dim LR As Long
Dim ZipMatch As Long

LR = ActiveSheet.Range("C65536").End(xlUp).Row
ZipMatch = ActiveCell.Value
ZipState = ActiveCell.Offset(0, -1).Address
For i = 6 To LR
If ZipMatch >= Cells(i, 4) And ZipMatch <= Cells(i, 5) Then
Range(ZipState) = Cells(i, 3)
End If
Next i
End Sub
 

Forum statistics

Threads
1,136,269
Messages
5,674,743
Members
419,525
Latest member
helensesc

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
Top