A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VLOOKUP returns unwanted/wrong values



 
 
Thread Tools Display Modes
  #1  
Old September 16th, 2008, 10:36 PM posted to microsoft.public.excel.worksheet.functions
wcollatz
external usenet poster
 
Posts: 3
Default VLOOKUP returns unwanted/wrong values

I'm using the VLOOKUP function to return data from a named range which
contains several data points (across the row) for several "sites" which are
numbered down the left in column A: 26e, 28e,...64e,64w,62w,60w... etc.

SAMPLE:

Row/Sec. 1 2 3 4 5...
Profile Depth (cm) 0.5 10.5 20.5 30.5 40.5...
26e 1.639885 21.143383 30.020775 27.024311 24.509054...
-2.5 7.5 17.5 27.5 37.5...
28e 15.430596 21.295532 25.333948 30.626244...
1 11 21 31 41...
30e 0.393868 10.764123 19.071701 15.003836 11.230032...
6.5 16.5 26.5 36.5...
32e 23.005785 21.448273 22.900213 19.946169...


The code I am using in another area of the sheet to return these numbers and
perform averages on them is:

=VLOOKUP("26e",profiledataeast,2,TRUE)

where profile dataeast is the named range for the top half of the range that
contains data for all east locations and data for the west locations is in
the bottom half of the range and I lookup the data with:

=VLOOKUP("26w",profiledatawest,2,TRUE)

The trouble I am having is, regardless of the designation "e" or "w" in my
alphanumeric lookup column on the left, Excel is returning the same data
(from the top half "e") to the right for both entries in the column that
contain a given number . This can be seen where the new data is displayed
after VLOOKUP gets it from "64e" and "64w":

64e 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708
64w 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708

The data returned is data from 64e, but gets returned for
=VLOOKUP("64w",profiledatawest,2,TRUE) too!

What am I overlooking?



  #2  
Old September 16th, 2008, 10:44 PM posted to microsoft.public.excel.worksheet.functions
Bernard Liengme
external usenet poster
 
Posts: 4,085
Default VLOOKUP returns unwanted/wrong values

You need to simplify the problem so we can see the trees for the forest.
For a start, to ask the question, you do not need all those decimal places
Tell use that ranges each name refers to
Then we can concentrate on the problem and not the data
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"wcollatz" wrote in message
...
I'm using the VLOOKUP function to return data from a named range which
contains several data points (across the row) for several "sites" which
are
numbered down the left in column A: 26e, 28e,...64e,64w,62w,60w... etc.

SAMPLE:

Row/Sec. 1 2 3 4 5...
Profile Depth (cm) 0.5 10.5 20.5 30.5 40.5...
26e 1.639885 21.143383 30.020775 27.024311 24.509054...
-2.5 7.5 17.5 27.5 37.5...
28e 15.430596 21.295532 25.333948 30.626244...
1 11 21 31 41...
30e 0.393868 10.764123 19.071701 15.003836 11.230032...
6.5 16.5 26.5 36.5...
32e 23.005785 21.448273 22.900213 19.946169...


The code I am using in another area of the sheet to return these numbers
and
perform averages on them is:

=VLOOKUP("26e",profiledataeast,2,TRUE)

where profile dataeast is the named range for the top half of the range
that
contains data for all east locations and data for the west locations is in
the bottom half of the range and I lookup the data with:

=VLOOKUP("26w",profiledatawest,2,TRUE)

The trouble I am having is, regardless of the designation "e" or "w" in my
alphanumeric lookup column on the left, Excel is returning the same data
(from the top half "e") to the right for both entries in the column that
contain a given number . This can be seen where the new data is displayed
after VLOOKUP gets it from "64e" and "64w":

64e 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708
64w 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708

The data returned is data from 64e, but gets returned for
=VLOOKUP("64w",profiledatawest,2,TRUE) too!

What am I overlooking?





  #3  
Old September 16th, 2008, 10:50 PM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default VLOOKUP returns unwanted/wrong values

Try replacing the TRUE argument with either FALSE or 0:

=VLOOKUP("26e",profiledataeast,2,0)

Using TRUE, the first column of the table would need to be sorted in
ascending order like this:

26e
26w
32e
32w
44e
44w

Not like this:

26e
32e
44e
26w
32w
44w

--
Biff
Microsoft Excel MVP


"wcollatz" wrote in message
...
I'm using the VLOOKUP function to return data from a named range which
contains several data points (across the row) for several "sites" which
are
numbered down the left in column A: 26e, 28e,...64e,64w,62w,60w... etc.

SAMPLE:

Row/Sec. 1 2 3 4 5...
Profile Depth (cm) 0.5 10.5 20.5 30.5 40.5...
26e 1.639885 21.143383 30.020775 27.024311 24.509054...
-2.5 7.5 17.5 27.5 37.5...
28e 15.430596 21.295532 25.333948 30.626244...
1 11 21 31 41...
30e 0.393868 10.764123 19.071701 15.003836 11.230032...
6.5 16.5 26.5 36.5...
32e 23.005785 21.448273 22.900213 19.946169...


The code I am using in another area of the sheet to return these numbers
and
perform averages on them is:

=VLOOKUP("26e",profiledataeast,2,TRUE)

where profile dataeast is the named range for the top half of the range
that
contains data for all east locations and data for the west locations is in
the bottom half of the range and I lookup the data with:

=VLOOKUP("26w",profiledatawest,2,TRUE)

The trouble I am having is, regardless of the designation "e" or "w" in my
alphanumeric lookup column on the left, Excel is returning the same data
(from the top half "e") to the right for both entries in the column that
contain a given number . This can be seen where the new data is displayed
after VLOOKUP gets it from "64e" and "64w":

64e 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708
64w 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708

The data returned is data from 64e, but gets returned for
=VLOOKUP("64w",profiledatawest,2,TRUE) too!

What am I overlooking?





  #4  
Old September 23rd, 2008, 07:33 PM posted to microsoft.public.excel.worksheet.functions
wcollatz
external usenet poster
 
Posts: 3
Default VLOOKUP returns unwanted/wrong values

Thanks T. Valko.

Replacing the true argument with 0 corrected the problem. I had previously
tried "FALSE" but that didn't seem to work. I'm not sure why or what the
difference between 0 and FALSE would be in this case.

Thanks again.

"T. Valko" wrote:

Try replacing the TRUE argument with either FALSE or 0:

=VLOOKUP("26e",profiledataeast,2,0)

Using TRUE, the first column of the table would need to be sorted in
ascending order like this:

26e
26w
32e
32w
44e
44w

Not like this:

26e
32e
44e
26w
32w
44w

--
Biff
Microsoft Excel MVP


"wcollatz" wrote in message
...
I'm using the VLOOKUP function to return data from a named range which
contains several data points (across the row) for several "sites" which
are
numbered down the left in column A: 26e, 28e,...64e,64w,62w,60w... etc.

SAMPLE:

Row/Sec. 1 2 3 4 5...
Profile Depth (cm) 0.5 10.5 20.5 30.5 40.5...
26e 1.639885 21.143383 30.020775 27.024311 24.509054...
-2.5 7.5 17.5 27.5 37.5...
28e 15.430596 21.295532 25.333948 30.626244...
1 11 21 31 41...
30e 0.393868 10.764123 19.071701 15.003836 11.230032...
6.5 16.5 26.5 36.5...
32e 23.005785 21.448273 22.900213 19.946169...


The code I am using in another area of the sheet to return these numbers
and
perform averages on them is:

=VLOOKUP("26e",profiledataeast,2,TRUE)

where profile dataeast is the named range for the top half of the range
that
contains data for all east locations and data for the west locations is in
the bottom half of the range and I lookup the data with:

=VLOOKUP("26w",profiledatawest,2,TRUE)

The trouble I am having is, regardless of the designation "e" or "w" in my
alphanumeric lookup column on the left, Excel is returning the same data
(from the top half "e") to the right for both entries in the column that
contain a given number . This can be seen where the new data is displayed
after VLOOKUP gets it from "64e" and "64w":

64e 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708
64w 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708

The data returned is data from 64e, but gets returned for
=VLOOKUP("64w",profiledatawest,2,TRUE) too!

What am I overlooking?






  #5  
Old September 23rd, 2008, 09:57 PM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default VLOOKUP returns unwanted/wrong values

I'm not sure why or what the difference between
0 and FALSE would be in this case.


There is no difference other than typing 0 takes fewer keystrokes! To
VLOOKUP they're identical and mean exactly the same thing.

So, if the formula is working that's all that counts.

Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"wcollatz" wrote in message
...
Thanks T. Valko.

Replacing the true argument with 0 corrected the problem. I had
previously
tried "FALSE" but that didn't seem to work. I'm not sure why or what the
difference between 0 and FALSE would be in this case.

Thanks again.

"T. Valko" wrote:

Try replacing the TRUE argument with either FALSE or 0:

=VLOOKUP("26e",profiledataeast,2,0)

Using TRUE, the first column of the table would need to be sorted in
ascending order like this:

26e
26w
32e
32w
44e
44w

Not like this:

26e
32e
44e
26w
32w
44w

--
Biff
Microsoft Excel MVP


"wcollatz" wrote in message
...
I'm using the VLOOKUP function to return data from a named range which
contains several data points (across the row) for several "sites" which
are
numbered down the left in column A: 26e, 28e,...64e,64w,62w,60w... etc.

SAMPLE:

Row/Sec. 1 2 3 4 5...
Profile Depth (cm) 0.5 10.5 20.5 30.5 40.5...
26e 1.639885 21.143383 30.020775 27.024311 24.509054...
-2.5 7.5 17.5 27.5 37.5...
28e 15.430596 21.295532 25.333948 30.626244...
1 11 21 31 41...
30e 0.393868 10.764123 19.071701 15.003836 11.230032...
6.5 16.5 26.5 36.5...
32e 23.005785 21.448273 22.900213 19.946169...


The code I am using in another area of the sheet to return these
numbers
and
perform averages on them is:

=VLOOKUP("26e",profiledataeast,2,TRUE)

where profile dataeast is the named range for the top half of the range
that
contains data for all east locations and data for the west locations is
in
the bottom half of the range and I lookup the data with:

=VLOOKUP("26w",profiledatawest,2,TRUE)

The trouble I am having is, regardless of the designation "e" or "w" in
my
alphanumeric lookup column on the left, Excel is returning the same
data
(from the top half "e") to the right for both entries in the column
that
contain a given number . This can be seen where the new data is
displayed
after VLOOKUP gets it from "64e" and "64w":

64e 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708
64w 2.087324 19.023703 17.246429 13.043617 16.659203 21.909708

The data returned is data from 64e, but gets returned for
=VLOOKUP("64w",profiledatawest,2,TRUE) too!

What am I overlooking?








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.