Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Excel 2007: Vlookup Problem

I don't use Vlookup much and it's not working for me. I know it's user error
so can you tell me what I did wrong?

I have two worksheets in my file. In the first one, I have a list of
addresses with a full unabbreviated US state name in column T, row 2. Column
U is blank because I want to put the two-digit state code in there (starting
with U2).

In the second worksheet I have the full state name in Column A and the
two-digit code for it in Column B (rows 1-50).

Here's my formula starting in U2:

=VLOOKUP(T2,StateCodes!$A$1:$B$50,2,FALSE)

What is wrong?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Excel 2007: Vlookup Problem

Your formula is correct in syntax and structure.

Is it possible that there are extra spaces in the name that are causing
errors? For example, if T2 contains "New York " this would cause the formula
to fail (or unprintable characters, if info was copied from outside source
like the internet). If so, you might try:

=VLOOKUP(TRIM(CLEAN(T2)),StateCodes!$A$1:$B$50,2,F ALSE)

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"ocean mist" wrote:

I don't use Vlookup much and it's not working for me. I know it's user error
so can you tell me what I did wrong?

I have two worksheets in my file. In the first one, I have a list of
addresses with a full unabbreviated US state name in column T, row 2. Column
U is blank because I want to put the two-digit state code in there (starting
with U2).

In the second worksheet I have the full state name in Column A and the
two-digit code for it in Column B (rows 1-50).

Here's my formula starting in U2:

=VLOOKUP(T2,StateCodes!$A$1:$B$50,2,FALSE)

What is wrong?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Excel 2007: Vlookup Problem

Drat! I tried your formula and it still doesn't work. New York is, of course,
one of the states. Could it be because not all cells in column T have
anything in them (yet)?

"Luke M" wrote:

Your formula is correct in syntax and structure.

Is it possible that there are extra spaces in the name that are causing
errors? For example, if T2 contains "New York " this would cause the formula
to fail (or unprintable characters, if info was copied from outside source
like the internet). If so, you might try:

=VLOOKUP(TRIM(CLEAN(T2)),StateCodes!$A$1:$B$50,2,F ALSE)

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"ocean mist" wrote:

I don't use Vlookup much and it's not working for me. I know it's user error
so can you tell me what I did wrong?

I have two worksheets in my file. In the first one, I have a list of
addresses with a full unabbreviated US state name in column T, row 2. Column
U is blank because I want to put the two-digit state code in there (starting
with U2).

In the second worksheet I have the full state name in Column A and the
two-digit code for it in Column B (rows 1-50).

Here's my formula starting in U2:

=VLOOKUP(T2,StateCodes!$A$1:$B$50,2,FALSE)

What is wrong?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Excel 2007: Vlookup Problem

I found the problem. The look-up table was NOT clean. It had extra spaces
after the state names, probably because it was copied from the Internet as
you said. I took them out and it is working now.

Many thanks for your help.

"ocean mist" wrote:

Drat! I tried your formula and it still doesn't work. New York is, of course,
one of the states. Could it be because not all cells in column T have
anything in them (yet)?

"Luke M" wrote:

Your formula is correct in syntax and structure.

Is it possible that there are extra spaces in the name that are causing
errors? For example, if T2 contains "New York " this would cause the formula
to fail (or unprintable characters, if info was copied from outside source
like the internet). If so, you might try:

=VLOOKUP(TRIM(CLEAN(T2)),StateCodes!$A$1:$B$50,2,F ALSE)

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"ocean mist" wrote:

I don't use Vlookup much and it's not working for me. I know it's user error
so can you tell me what I did wrong?

I have two worksheets in my file. In the first one, I have a list of
addresses with a full unabbreviated US state name in column T, row 2. Column
U is blank because I want to put the two-digit state code in there (starting
with U2).

In the second worksheet I have the full state name in Column A and the
two-digit code for it in Column B (rows 1-50).

Here's my formula starting in U2:

=VLOOKUP(T2,StateCodes!$A$1:$B$50,2,FALSE)

What is wrong?

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel 2007: Vlookup Problem

Sounds like should work as long as the full state names in T2:T51 match
those in StateCodes A1:A50

Why do you say "it's not working"?

Did you drag U2 down to U51?

What results do you get?

Is it possible you have extra space(s) in a state name in either sheet?


Gord Dibben MS Excel MVP


On Fri, 8 Jan 2010 13:16:01 -0800, ocean mist
wrote:

I don't use Vlookup much and it's not working for me. I know it's user error
so can you tell me what I did wrong?

I have two worksheets in my file. In the first one, I have a list of
addresses with a full unabbreviated US state name in column T, row 2. Column
U is blank because I want to put the two-digit state code in there (starting
with U2).

In the second worksheet I have the full state name in Column A and the
two-digit code for it in Column B (rows 1-50).

Here's my formula starting in U2:

=VLOOKUP(T2,StateCodes!$A$1:$B$50,2,FALSE)

What is wrong?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel 2007: Vlookup Problem

Luke

TRIM and CLEAN won't clear the 0160 non-breaking space if that's what the
problem is.

EditReplace

What: Alt + 0160

With: nothing

Is the only way to clear the nbsp


Gord

On Fri, 8 Jan 2010 13:31:02 -0800, Luke M
wrote:

Your formula is correct in syntax and structure.

Is it possible that there are extra spaces in the name that are causing
errors? For example, if T2 contains "New York " this would cause the formula
to fail (or unprintable characters, if info was copied from outside source
like the internet). If so, you might try:

=VLOOKUP(TRIM(CLEAN(T2)),StateCodes!$A$1:$B$50,2, FALSE)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 IRM problem gwaxiom Excel Discussion (Misc queries) 0 November 20th 09 05:52 PM
Excel 2007 Query Wizard problem with Access 2007 extensions Showdad Excel Discussion (Misc queries) 0 December 4th 08 05:57 PM
Problem with Vlookup in Excel keeno Excel Worksheet Functions 2 February 13th 08 06:06 PM
Excel Forumla (vlookup problem) dan61021 Excel Discussion (Misc queries) 0 February 13th 06 03:41 AM
Excel Problem: VLookup andyp161 Excel Worksheet Functions 1 November 18th 04 12:29 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"