FormulaCraft

How to extract the state from an address in Excel and Google Sheets

Topic:Text manipulation
Excel & Google Sheets
=MID(A2,FIND(", ",A2,FIND(",",A2))+2,2)

Verified example

Computed by a real spreadsheet engine on the sample data below.

Address
123 Main St, Austin, TX 78701
456 Oak Ave, Miami, FL 33101
789 Pine Rd, Denver, CO 80201
321 Elm Blvd, Seattle, WA 98101

=MID(A2,FIND(", ",A2,FIND(",",A2))+2,2)Au

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Ensure your addresses follow the standard format: Street, City, ST ZIP (two commas).
  2. 2Find the position of the second comma using FIND(",",A2) to get the first comma, then FIND(", ",A2,first+1) to get the second.
  3. 3After the second comma and space, the state abbreviation occupies positions start+2 and start+3.
  4. 4Use =MID(A2, FIND(", ",A2,FIND(",",A2))+2, 2) to extract exactly two characters.
  5. 5If addresses have only one comma (City ST ZIP), adjust to find the space before the state using FIND or RIGHT-based logic.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

What if some addresses include a suite or unit number adding a third comma?

Use a RIGHT-based approach instead: =TRIM(MID(A2,LEN(A2)-FIND(" ",TRIM(SUBSTITUTE(A2,",",REPT(" ",100)),MAX(1,LEN(TRIM(SUBSTITUTE(A2,",",REPT(" ",100))))-99)))+1,2)) — or clean the data first.

Can I extract the full state name instead of abbreviation?

Not directly from the address without a lookup table. Extract the abbreviation first, then use VLOOKUP or XLOOKUP against a state code table to get the full name.

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: