Looking up a state based on a zipcode.

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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.
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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