Thread: area code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
carlo carlo is offline
external usenet poster
 
Posts: 367
Default area code

Hi Junkman

Why don't you use vlookup?

on a new sheet make following matrix:
Column A: AreaCodes
Column B: State

then on your original sheet put following formula in your first row:

=vlookup(left(B1,4),matrix!$A$1:$B$50,2,false)

you have to adjust following data:
left(B1,4) should return the code how you entered it in the matrix in
column A
matrix!$A$1:$B$50 should be the area of the matrix

hth otherwise ask :)

Carlo

On Dec 19, 12:43 pm, junkman wrote:
I have one column that has list of phone numbers with area code. I
need to make new column for which state. I would like to make a small
macro program to check the area code and put two letters state on new
column. How do we do that. I was thinking to use loop for read each
row and use if area code = (301) then row 1 = CA elseif area code =
(302) then row 1 = UT.... I don't know where to start..