Please read, can't figure how to tell in subject what the need is! :)

4

43fan

Hello!

I have an area code list, that has all area codes for each state listed,
like this:
203, 475, 860, 959 <--- In cell A1
Connecticut<--- In cell B1

of course, all states are listed in column B, and all codes for each
state are in column A, with commas separating
each code.

I have a db with contact names and their phone numbers, with area code
broken out. The eventual thing is,
I want to search through my area code list and put the state it
belongs to in the contacts db.

Using vlookup, I get a #ref when I try to do this. I'm guessing
because each cell with the area code in it doesn't
only have one value but could have multiple ones separated by commas?

If this is the case, how can I easily manipulate the data around to
put one area code in each row with the corresponding
State in the cell adjacent to it?

Thanks!!
Shawn
 
F

Frank Kabel

Hi
try the following array formula
=INDEX(B1:B100,MATCH(TRUE,ISNUMBER(SEARCH("203",A1:A100)),0))

Replace '203' with a cell reference of the wantes array code
 
M

Max

Perhaps this might work ..

Assuming the data below is in Sheet1,
cols A and B, from row1 down
[ Area codes in col A, State in col B ]
203, 475, 860, 959 <--- In cell A1
Connecticut<--- In cell B1

In Sheet2
-----------
Assuming the area codes of your db are in col C, C1 down

Put in D1:
=IF(ISNA(MATCH("*"&C1&"*",Sheet1!A:A,0)),"",TRIM(OFFSET(Sheet1!$A$1,MATCH("*
"&C1&"*",Sheet1!A:A,0)-1,1)))

Copy D1 down

Col D will return the "State" from Sheet1

Unmatched area codes in col C will return blanks ""
 
4

43fan

Frank,

Thanks, but I must be doing something wrong. I get a #N/A error.

Is there an easy way to split out all the area codes into a separate cell?
Then VLOOKUP should do the trick, as long as they're sorted properly. I can
sort them and save them that way, no problem. I'll need to "run" the
routine to put the States in at least once a month on new data, and right
now that new data is approx. 2000 records each month.

Thanks!! :)
Shawn
 
F

Frank Kabel

Hi
enter it as array formula (with CTRL+SHIFT+ENTER)

For splitting the array code you could use 'Data - Text to columns'.
But the formula entered as array formula should do
 
4

43fan

Frank,

Duh! That got it! I think I was just hitting CTRL-ENTER and not putting the
shift in. I don't do all that much work with Excel, and especially with
array formulas, and forgot the proper entry sequence. :)

Thanks!!
Shawn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top