Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Do a lookup with VBA based on criteria in three cells

In english, the code would need to find the intercept of matching
Command and Room, find the Object for those, identify the cell
reference of that Object, and then return Desc from the column
immediately to the right.


Assuming the source sheet (as posted) is named simply as: x
with Room1, Desc, Room2, etc listed in B1 across
and CommandX, etc listed in A2 down

then in the sheet where you have 3 lookup var listed in A1:A3, eg:
A1=CommandX
A2=Room1
A3=Object3


you could place this in say, A4,
array-entered (press CTRL+SHIFT+ENTER to confirm the formula):
=INDEX(OFFSET(x!1:1,MATCH(1,(x!A1:A100=A1)*(OFFSET (x!A1:A100,,MATCH(A2,x!1:1,0)-1)=A3),0)-1,),MATCH(A2,x!1:1,0)+1)
to return the required result from the description col adjacent to the
"Room#"
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"S Davis" wrote in message
...
Hello,

This is a bit tricky to explain. Forgive me, I'll do my best.

Based on the contents of three cells on one sheet, I would like to
know the location (cell reference, ie $B$33) of the item desired, and
then return the contents of the cell immediately adjacent to it.

Let's say the cells I want to look up are he
A1=CommandX
A2=Room1
A3=Object3

I want to return "Desc" from another worksheet in the below example:


------------------Room1--------Description---------Room2--------
Description ..... RoomN
CommandX---Object1-------Desc------------------ObjectN+1---Desc.....
CommandX---Object2-------Desc------------------ ....
CommandX---Object3-------Desc...
....
CommandY---ObjectN------Desc...
......
CommandZ.........


So its not terribly pretty.

In english, the code would need to find the intercept of matching
Command and Room, find the Object for those, identify the cell
reference of that Object, and then return Desc from the column
immediately to the right.

Is this posssible?



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
lookup based on 2 criteria SteveC Excel Worksheet Functions 1 August 7th 08 09:48 PM
Lookup based on two criteria. . . bokonon Excel Discussion (Misc queries) 3 February 2nd 06 07:41 PM
Lookup based on 2 criteria L. S. Martin Excel Worksheet Functions 13 July 16th 05 10:14 PM
Lookup based on two criteria in 1 row BethP Excel Discussion (Misc queries) 3 April 12th 05 06:47 AM
LOOKUP value based on 2 criteria Jaye Excel Worksheet Functions 1 November 22nd 04 11:08 PM


All times are GMT +1. The time now is 02:45 PM.

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

About Us

"It's about Microsoft Excel"