VLOOKUP HLOOKUP


Posted by James Yoo on May 25, 2000 12:42 PM

I understand that you can look up text in the first row
or column of an array and return the content of a cell
in that same row or column. I'd like to search the
whole array(very big A1:DR99) for specific text and
have it return data in the same row but a different
column. Any ideas?

Posted by Celia on May 25, 2000 3:34 PM


James
One way is with a macro using For...Next.

For example, if you wanted to look in column A for cells containing 'YourText', and then (say) highlight in yellow the cells in column C of the same row :-

Sub YourMacro()
Dim cell As Range, colA As Range
Set colA = Range(Range("A1"), Range("A65536").End(xlUp))
For Each cell In colA
If cell = "YourText" Then
cell.Offset(0, 2).Interior.ColorIndex = 6
End If
Next
End Sub

Please provide specific details of what you want to do, if you need more help

Celia

Posted by James Yoo on May 30, 2000 4:33 AM

Sorry Celia for not being specific enough. I didn't think that people would
respond in depth to it.

I've got a parts list(about 100 different parts in row 1-100).
Columns A-J show the description of each part (Item #, Quantity, Description,
Manufacturer, Manufacturer Part Number, Raytheon Part number, Comments, etc).
Columns J-DR are reference designators for each part. The amount of
designators range from 1 to 112. So depending on how many designators that
each part has, there may be a ref. designator just in Col J or ref. designators
in Col J-DR for each specific part. Okay, that was just the background.

What I am trying to do is to create another spreadsheet file with links to the
parts list. I want to type in the reference designators in Col A. And because
the designators go in order (let's say R1-R100), I want to just do a fill-down
for that. So for R1, I want it to look for the reference designator in the parts
list (could be anywhere from J1-DR100), and return for instance the part number
in Col B. And since I've got about 1000 parts, I was wondering if there is any
way I could do that with an equation so I can do a fill-down.

Posted by Celia on May 30, 2000 6:48 AM

Sorry Celia for not being specific enough. I didn't think that people would


James
It's still a bit difficult without seeing an actual workbook with some actual data.
I can't think of a way by using worksheet functions but it might be possible.
It can, of course, be done with a macro but again it is difficult to know the best way without seeing the workbook.
If I have understood your explanation correctly, one way would be as follows (this can also be done manually but would take a long time) :-

1.Copy the Sheet1 Col B data in rows 1-100 to Sheet2 Col B.
2.Copy this data 112 times down Sheet2 Col B. (This can be done manually with one copy/paste).
3.Copy the Sheet1 data in rows 1-100 in each of the columns J-DR to Sheet2 Col A. (Manually, this would need to be done one column at a time!!)
4.Sort Sheet2 by ColA/ColB.
5.Delete Sheet2 rows with no data in Col A.

If this is what you want, I will do a macro.

Celia



Posted by James Yoo on May 30, 2000 10:09 AM

Yes, I think it is hard to explain in words without seeing the worksheet. But your answer did give me an idea of how
I can sort my parts list and do a cut and paste. Thank you for trying though. I really appreciated it.