Lookup formula

JV0710

Active Member
Joined
Oct 26, 2006
Messages
429
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Hi, Please help me with this lookup query.

I have a column of data in a hierarchy (columnA).

As per the picture posted: if I type the store in cell D3, I want a formula in E3 to return the area that the store belongs in.

Thank you
JVN
Book1
ABCDEFGHIJ
1%GrowthStoreArea
2Area112
3store110store6Area2
4store214
5store312needaformulainE3thatwillreturntheareathatstore6(F3)belongsin
6Area214
7store410
8store510
9store615
10store716
11store84
12Area39
13store96
14store106
15store1112
16store128
Sheet1
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Thank you Aladin

This works great. . .

I would like to add a complication though . . .

If I am not able to specify the name of the "parent" i.e. Area, then how will i determine the answer. for example I may have Region, area, Store and product . . . example:
Area lookup query.xls
ABCDEFGH
1%GrowthStoreArea
2Region112.5
3Area112
4store110prod1store5
5store214
6store312needaformulainE3thatwillreturntheparentof(F3)
7Area214
8store410
9store510
10prod17
11prod213
12store615
13store716
14store84
15Region29
16Area39
17store96
18store106
19store1112
20store128
Sheet1
 
Upvote 0
I'm sorry . . . That should read " the parent of (D3)"
 
Upvote 0
I'm sorry . . . That should read " the parent of (D3)"

What would be the parent of prod2?

BTW, your data representation is not optimal in that it requires expensive processing...
 
Upvote 0
The parent of prod2 would also be store5.

The data presentation is from an export into excel from reporting system. I am trying to do conditional formatting based on comparing performance of the Area, store, etc to it's parent performance.

for example: prod1 % growth is lower than the parent (Store) % growth and prod2 % growth is higher
 
Upvote 0
The parent of prod2 would also be store5.

The data presentation is from an export into excel from reporting system. I am trying to do conditional formatting based on comparing performance of the Area, store, etc to it's parent performance.

for example: prod1 % growth is lower than the parent (Store) % growth and prod2 % growth is higher

=LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D4,$A$2:$A$20,0)),5)="Store"),$A$2:$A$20)
 
Upvote 0
Thanks Aladin

I think I can work with this

I have joined the two formulae that you gave above and it works if I enter "prod*" in cell D4, but I get #N/A if I enter "store*"

=IF(LEFT(D4,5)="Store",LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D3,$A$2:$A$50,0)),4)="Area"),$A$2:$A$50),IF(LEFT(D4,4)="prod",LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D4,$A$2:$A$50,0)),5)="Store"),$A$2:$A$50),""))
 
Upvote 0
Thanks Aladin

I think I can work with this

I have joined the two formulae that you gave above and it works if I enter "prod*" in cell D4, but I get #N/A if I enter "store*"

=IF(LEFT(D4,5)="Store",LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D3,$A$2:$A$50,0)),4)="Area"),$A$2:$A$50),IF(LEFT(D4,4)="prod",LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D4,$A$2:$A$50,0)),5)="Store"),$A$2:$A$50),""))

=LOOKUP(2,1/(LEFT(OFFSET(A2,0,0,MATCH(D4,$A$2:$A$20,0)),4)=VLOOKUP(LEFT(D4,4)&"*",{"Prod","Stor";"Stor","Area"},2,0)),$A$2:$A$20)
 
Upvote 0
Thank you !!!! You are the Champ !!!!!

I have been working on the spreadsheet and . . . here is another way of asking the question . . . Perhaps I should have asked it like this in the first place. . . But your formula above works just fine .

---------
In Column A and for example: In cell D7, if the value in A7 = "A", then "", else, if the value in A7<> "A" then need formula to find in column A from A7 upwards the first cell that has a different letter (A4) and return the corresponding value in column B ----> Answer = 24.
Area lookup queryxx.xls
ABCD
1
2A9
3B179
4B249
5c1124
6c1524
7c1224
8A14
9B1214
10c1212
11c1612
12B1914
13c2119
14c1019
15A13
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top