I have a file that is about 7,000 entries long and I need to separate a
column with city & state so I can put the info into our main database (it has
city and state separated). Is there a formatting formula I can use either in
Excel or Access? Also, is there any way to do the same thing for first and
last name?
It's possible but might be a bit tricky using an update query. It
depends on how your data is formatted - you need some way to isolate
the state from the city-state field. Does the state always appear
last? Always as the two-letter state code or sometimes as the state
name? Is it preceded by a comma? if so, sometimes or consistantly?
Names are similarly tricky: Lisa May Grovner's first name is Lisa May;
Hans de la Meer's first name is Hans. It can be tricky deciding what's
first and what's last!
A ROUGH CUT approach would be to add City and State fields to your
table, and run an Update query updating City to
Trim(Left([CityState], InStr([CityState], " ") - 1))
and State to
Trim(Mid([CityState], InStr([CityState], " ") + 1))
replacing " " by "," if you consistantly have a comma before the state
name. This will give you a City value of "Salt" and a State of "Lake
City UT" as written - you'll need to allow enough room in the State
field for this, and do a followup query for states containing a blank.
John W. Vinson[MVP]