Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
am having lookup problems, please help | Excel Discussion (Misc queries) | |||
LOOKUP problems | Excel Worksheet Functions | |||
Lookup problems | Excel Worksheet Functions | |||
v-lookup problems | Excel Worksheet Functions | |||
Lookup problems | Excel Worksheet Functions |