#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default Lookup problems?

I have a problem. i have some code in VBA that returns the contents of a cell
from another sheet - steel description:
C3 x 4.1
C5 x 6.2
2 x 2
2 x 4
1 x 1 x .125
etc.
It is returned by using
CalcSht.cells(NewRow, ListCol) = Description
whe NewRow, List Col give the location.. ie (2,3) for Cell C2 on my
calcSht.
Description = DataSht.Range("A"&Rowcounter) - for getting the specific row...

so. it then can print C3 x 4.1 exactly as it was in the Data sheet on the
Calc sheet.
THEN: i use Lookup(Value, LookupArray, ReturnArray) to lookup the steel
description, and return other properties that are related to that specific
steel type.
=Lookup(C2, 'Steel'!A1:A5,'Steel'!B1:B5) for example.

Herein lies my problem. any steel size with 'C' preceding the dimensions
are ignored...and automatically lookup returns the bottom number.
Why would there be a difference in the cells so that it doesnt recognize the
cell contents?
can anyone help me?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Lookup problems?

=Lookup(C2, 'Steel'!A1:A5,'Steel'!B1:B5)

The LOOKUP function *requires* that the data be sorted in ascending order:

1 x 1 x .125
2 x 2
2 x 4
C3 x 4.1
C5 x 6.2

If you don't want to/can't sort the data then use VLOOKUP:

=VLOOKUP(C2,Steel!A1:B5,2,0)

--
Biff
Microsoft Excel MVP


"Derrick" wrote in message
...
I have a problem. i have some code in VBA that returns the contents of a
cell
from another sheet - steel description:
C3 x 4.1
C5 x 6.2
2 x 2
2 x 4
1 x 1 x .125
etc.
It is returned by using
CalcSht.cells(NewRow, ListCol) = Description
whe NewRow, List Col give the location.. ie (2,3) for Cell C2 on my
calcSht.
Description = DataSht.Range("A"&Rowcounter) - for getting the specific
row...

so. it then can print C3 x 4.1 exactly as it was in the Data sheet on the
Calc sheet.
THEN: i use Lookup(Value, LookupArray, ReturnArray) to lookup the steel
description, and return other properties that are related to that specific
steel type.
=Lookup(C2, 'Steel'!A1:A5,'Steel'!B1:B5) for example.

Herein lies my problem. any steel size with 'C' preceding the dimensions
are ignored...and automatically lookup returns the bottom number.
Why would there be a difference in the cells so that it doesnt recognize
the
cell contents?
can anyone help me?



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
am having lookup problems, please help drwainscott Excel Discussion (Misc queries) 1 August 15th 08 02:44 AM
LOOKUP problems Martin Ledgard Excel Worksheet Functions 3 September 7th 07 11:42 PM
Lookup problems Rose Davis Excel Worksheet Functions 1 October 18th 06 05:50 AM
v-lookup problems DF Excel Worksheet Functions 0 June 6th 06 10:36 PM
Lookup problems JaB Excel Worksheet Functions 2 September 22nd 05 12:33 PM


All times are GMT +1. The time now is 02:03 AM.

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

About Us

"It's about Microsoft Excel"