ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   lookup, intersect, find ? (https://www.excelbanter.com/excel-programming/309903-re-lookup-intersect-find.html)

Tom Ogilvy

lookup, intersect, find ?
 
This assumes the value of animal and color will be found.
Dim val as Variant

Dim rng1 as Range, rng2 as Range
set rng1 = Range(Cells(1,1),Cells(1,2).End(xltoRight))
set rng2 = Range(Cells(1,1),Cells(2,1).End(xldown))

val = Cells(rng2.Find(color).row, rng1.Find(animal).Column).Value

--
Regards,
Tom Ogilvy


"Matt" wrote in message
...
Ok, I've searched the groups and haven't found exactly what I'm looking
for....or perhaps I'm just not understanding the solution... which is more
likely the case.

I have two variables; for this example we'll call them "Color" and

"Animal"
which are selected by users via a form. I then want to take those two
variables and search a table on a worksheet to find a value. The table

would
look like:

cat dog bird
red 0.31 0.22 0.11
blue 0.55 0.61 0.69
green 0.78 0.81 0.85

So assuming the user picked "dog" and "blue" in the form, the result would
be 0.61. Lookup and Intersect seem to based on already knowing the

address,
column, or row...is this correct?

I suppose I could search row 1 for the matching Animal, then search column

A
for the matching Color, and then finally do a lookup on those results. Is
there an easier way to do this without having to do three statements?

thanks!






All times are GMT +1. The time now is 06:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com