You’re on the right track with using MID, but you’ll first need to use FIND to locate some portion of text in the address field. I’d suggest locating the “State:” text with FIND, and then you use combine that with MID to extract only the two digit abbreviation.
MID({Address}, FIND("State:",{Address}) + 7, 2)
The +7 in the formula is used to set the starting point for MID just before ‘DC’, and the 2 used in the formula designates how many characters to count.
As long as the state portion of your address field follows the same structure as the example you gave (e.g. State: XX), this formula will extract the state abbreviations.
You’re on the right track with using MID, but you’ll first need to use FIND to locate some portion of text in the address field. I’d suggest locating the “State:” text with FIND, and then you use combine that with MID to extract only the two digit abbreviation.
MID({Address}, FIND("State:",{Address}) + 7, 2)
The +7 in the formula is used to set the starting point for MID just before ‘DC’, and the 2 used in the formula designates how many characters to count.
As long as the state portion of your address field follows the same structure as the example you gave (e.g. State: XX), this formula will extract the state abbreviations.
Thanks Jason, that’s awesome.
To expand on that, if I want to pull out the city portion (which has a variable number of characters vs the state which is always 2), what would be the method for that? Can I define boundaries around a string (like find the part between City: and State:)?
Thanks Jason, that’s awesome.
To expand on that, if I want to pull out the city portion (which has a variable number of characters vs the state which is always 2), what would be the method for that? Can I define boundaries around a string (like find the part between City: and State:)?
You can define boundaries through a combination of MID, FIND, and LEFT; here’s how.
Step 1
First, isolate the only the text starting with the city; this will include the rest of the string as well.
Then, use another similar formula to extract *just* the city name from the result of the above formula. In this step, you'll need to include the entire formula used above as part of another formula. I'll include that as a placeholder (INSERT FORMULA FROM STEP 1) for now.
LEFT(
INSERT FORMULA FROM STEP 1,
FIND(
"State:",
INSERT FORMULA FROM STEP 1
)
-1
)
Step 3
Replace the placeholder (INSERT FORMULA FROM STEP 1) with the actual formula from step 1. When combined together, the entire formula would be: