Lookup problems?

D

Derrick

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
where: 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?
 
T

T. Valko

=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)
 

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