Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Area Code "Location" syntax

Status
Not open for further replies.

WayneGro

IS-IT--Management
Jan 28, 2005
1
US
I would like to write a formula or get a copy of one that has all the US area codes in it and where they are. For example 913 area code is in Kansas, etc. etc. I have done some searching on the web and haven't found anything but I would imagine that someone has already developed this?

I would like the output to be like this;

(904)florida, 555-1212 without going in and writing all the syntax myself, is there anyone who knows where I can find something similar to this?
 
You could get a list off the web (like here or here) and parse it out to create your own formula, or perhaps a better idea would be to create an Area Codes table in your database.

-dave
 
Why not just create a TXT table based on the data found at -


You can then just use CR linking tool, and include the State Name in your detail data and/or formulas.

Of course, you'll need to manually update the TXT table every few months, but it should help.
 
Wayne-

I put this together a few weeks ago so it is up-to-date. Hopefully it can save you some leg work.

If {@AreaCode} in ["403","780","250","604","778","204","506","709","902"] then "Canada" else
If {@AreaCode} in ["907"] then "Alaska" else
If {@AreaCode} in ["205","251","256","334"] then "Alabama" else
If {@AreaCode} in ["479","501","870"] then "Arkansas" else
If {@AreaCode} in ["480","520","602","623","928"] then "Arizona" else
If {@AreaCode} in ["209","213","310","323","341","369","408","415","424","442","510","530","559","562","619","626","627","628","650","657","661","669","707","714","747","752","760","764","805","818","831","858","909","916","925","935","949","951"] then "California" else
If {@AreaCode} in ["303","719","720","970"] then "Colorado" else
If {@AreaCode} in ["203","475","860","959"] then "Connecticut" else
If {@AreaCode} in ["202"] then "D.C." else
If {@AreaCode} in ["302"] then "Delaware" else
If {@AreaCode} in ["239","305","321","352","386","407","561","689","727","754","772","786","813","836","850","861","863","904","941","954"] then "Florida" else
If {@AreaCode} in ["229","404","470","478","678","706","770","912"] then "Georgia" else
If {@AreaCode} in ["808"] then "Hawaii" else
If {@AreaCode} in ["319","515","563","641","712"] then "Iowa" else
If {@AreaCode} in ["208"] then "Idaho" else
If {@AreaCode} in ["217","224","282","309","312","331","464","618","630","708","773","815","847","872"] then "Illinois" else
If {@AreaCode} in ["219","260","317","574","765","812"] then "Indiana" else
If {@AreaCode} in ["316","620","785","913"] then "Kansas" else
If {@AreaCode} in ["270","327","502","606","859"] then "Kentucky" else
If {@AreaCode} in ["225","318","337","504","985"] then "Louisiana" else
If {@AreaCode} in ["339","351","413","508","617","774","781","857","978"] then "Massachusetts" else
If {@AreaCode} in ["240","249","280","301","410","443","969"] then "Maryland" else
If {@AreaCode} in ["207","383"] then "Maine" else
If {@AreaCode} in ["231","248","269","278","313","517","546","586","616","679","734","810","906","947","989"] then "Michigan" else
If {@AreaCode} in ["218","320","507","612","651","763","952"] then "Minnesota" else
If {@AreaCode} in ["314","417","557","573","636","660","816","975"] then "Missouri" else
If {@AreaCode} in ["228","601","662"] then "Mississippi" else
If {@AreaCode} in ["406"] then "Montana" else
If {@AreaCode} in ["252","336","704","828","910","919","980","984"] then "North Carolina" else
If {@AreaCode} in ["701"] then "North Dakota" else
If {@AreaCode} in ["308","402"] then "Nebraska" else
If {@AreaCode} in ["603"] then "New Hampshire" else
If {@AreaCode} in ["201","551","609","732","848","856","862","908","973"] then "New Jersey" else
If {@AreaCode} in ["505","957"] then "New Mexico" else
If {@AreaCode} in ["702","775"] then "Nevada" else
If {@AreaCode} in ["212","315","347","516","518","585","607","631","646","716","718","845","914","917"] then "New York" else
If {@AreaCode} in ["216","234","283","330","380","419","440","513","567","614","740","937"] then "Ohio" else
If {@AreaCode} in ["405","918","580"] then "Oklahoma" else
If {@AreaCode} in ["503","541","971"] then "Oregon" else
If {@AreaCode} in ["215","267","358","412","445","484","570","610","717","724","814","835","878"] then "Pennsylvania" else
If {@AreaCode} in ["423","615","731","865","901","931"] then "" else
If {@AreaCode} in ["210","214","254","281","325","361","409","430","432","469","512","682","713","737","806","817","830","832","903","915","936","940","956","972","979"] then "Texas" else
If {@AreaCode} in ["385","435","801"] then "Utah" else
If {@AreaCode} in ["236","276","381","434","540","571","703","757","804"] then "Virginia" else
If {@AreaCode} in ["206"] then "Vermont" else
If {@AreaCode} in ["206","253","360","425","509","564"] then "Washington" else
If {@AreaCode} in ["262","353","414","420","608","715","920"] then "Wisconsin" else
If {@AreaCode} in ["304"] then "West Virginia" else
If {@AreaCode} in ["307"] then "Wyoming" else {@AreaCode}
 
A formula with area codes sounds pretty inefficient, why not build a table of them and join the data? Especially because things change often these days, you'll need to go into this report and change things rather than managing it in a single location which is available to all processes.

I used to do a lot of demographics and needed to link area codes, zip codes, longitude/latitude stuff, and embedding it in a formula doesn't make sense long term.

btw, here's a listing with cities as well as states:


-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top