SOLVED

Create Lookup to Variable Sheet Name and Dynamic Cell Reference Based on 2 Drop Down Validations

%3CLINGO-SUB%20id%3D%22lingo-sub-2113600%22%20slang%3D%22en-US%22%3ECreate%20Lookup%20to%20Variable%20Sheet%20Name%20and%20Dynamic%20Cell%20Reference%20Based%20on%202%20Drop%20Down%20Validations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2113600%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%2050%20separate%20tabs%20of%20sales%20data%2C%20with%20each%20tab%20representing%20sales%20data%20for%20a%20single%20state.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20each%20of%20the%2050%20tabs%2C%20I%20have%20sales%20data%20for%20multiple%20products.%26nbsp%3B%20Each%20product%20has%20information%20such%20as%20sales%20price%2C%20discounts%2C%20etc.%26nbsp%3B%20The%20structure%20of%20each%20of%20the%2050%20state%20sales%20tab%20is%20like%20this%20below%20in%20a%20vertical%20format%20(I%20have%20upwards%20of%2020%20unique%20products%20but%20just%20listing%202%20as%20an%20example).%26nbsp%3B%20There%20is%20spacing%20between%20the%20name%20of%20each%20Product%20and%20the%20product%20specific%20amounts%20such%20as%20sales%20price%20and%20discounts%20that%20cannot%20be%20removed%20as%20it%20contains%20other%20product%20specific%20data.%26nbsp%3B%20However%2C%20there%20is%20uniformity%20for%20each%20Product%20listing%20(i.e.%20there%20is%20always%202%20rows%20that%20separate%20the%20name%20of%20the%20Product%20and%20the%20Sales%20Price%20for%20that%20product).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EProduct%20A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESales%26nbsp%3B%20%26nbsp%3B%2450%3C%2FP%3E%3CP%3EDiscount%20%2425%3C%2FP%3E%3CP%3ENet%20Sales%20%2425%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EProduct%20B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESales%20%2455%3C%2FP%3E%3CP%3EDiscount%20%2425%3C%2FP%3E%3CP%3ENet%20Sales%20%2430%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20create%20a%20Summary%20table%20that%20has%20two%20drop%20down%20validations.%26nbsp%3B%20The%201st%20data%20validation%20is%20the%20State%20Abbreviation.%26nbsp%3B%20The%202nd%20data%20validation%20will%20be%20the%20name%20of%20the%20product%20(i.e.%20Product%20A%20or%20Product%20B%20as%20in%20the%20example%20above).%26nbsp%3B%20Based%20on%20these%20two%20data%20validations%2C%20I%20would%20like%20to%20be%20able%20to%20go%20to%20the%20appropriate%20state%20sales%20data%20tab%20and%20the%20specific%20cell%20reference%20that%20has%20the%20data.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20far%2C%20I%20have%20thought%20about%20using%20some%20combination%20of%3A%3C%2FP%3E%3CP%3E1)%20INDIRECT%20-%20Refer%20to%20the%20State%20Abbreviation%20drop%20down%20validation%20so%20I%20can%20pull%20the%20appropriate%20state%20tab%20as%20I%20change%20the%20drop%20down%3C%2FP%3E%3CP%3E2)%20CONCATENATE%20or%20%26amp%3B%3C%2FP%3E%3CP%3E3)%20CELL%2FADDRESS%20Function%20-%20Use%20this%20to%20refer%20to%20the%20exact%20cell%20reference%20that%20will%20have%20this%20information%20on%20each%20tab.%26nbsp%3B%20For%20example%2C%20if%20I%20wanted%20to%20find%20Product%20A's%20sale%20price%20in%20each%20state%2C%20it%20would%20always%20be%20in%20let's%20say%20Cell%20B4%20on%20every%20single%20state%20tab.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20far%2C%20the%20best%20I%20have%20been%20able%20to%20do%20is%20to%20get%20to%20something%20along%20these%20lines%3A%3C%2FP%3E%3CP%3E%3DINDIRECT(%22'%22%26amp%3B%24C%243%26amp%3B%22!%22%26amp%3BADDRESS(3%2C2))%2C%20where%20%24C%243%20is%20referring%20to%20my%20State%20Abbreviation%20Dropdown.%26nbsp%3B%20I%20don't%20know%20how%20to%20be%20able%20to%20create%20a%20dynamic%20cell%20reference%20lookup%20in%20the%20last%20part%20with%20the%20address%20function.%26nbsp%3B%20I%20was%20thinking%20of%20creating%20a%20table%20that%20has%20the%20row%20and%20column%20number%20that%20I%20could%20lookup%20to%20but%20don't%20even%20know%20where%20I%20am%20going%20with%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20direction%20would%20be%20appreciated.%26nbsp%3B%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2113600%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2116625%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Lookup%20to%20Variable%20Sheet%20Name%20and%20Dynamic%20Cell%20Reference%20Based%20on%202%20Drop%20Down%20Validations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2116625%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3BPowerQuery%20is%20a%20great%20suggestion%20here.%26nbsp%3B%20Will%20give%20it%20a%20try%20also%20to%20see%20what%20kind%20of%20results%20I%20may%20get.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2116624%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Lookup%20to%20Variable%20Sheet%20Name%20and%20Dynamic%20Cell%20Reference%20Based%20on%202%20Drop%20Down%20Validations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2116624%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BThanks.%26nbsp%3B%20I%20have%20tried%20to%20restructure%20the%20data%20and%20right%20now%20it%20is%20looking%20like%20this.%26nbsp%3B%20The%20idea%20is%20the%20same%20just%20changed%20my%20drop%20downs%20to%20city%20and%20division.%26nbsp%3B%20Trying%20to%20use%20a%20combination%20of%20index%2C%20match%20and%20concatenate%20right%20now%20to%20retrieve%20the%20restructured%20data%20which%20is%20now%20residing%20in%20one%20single%20tab%20inside%20of%2050%20tabs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2113830%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Lookup%20to%20Variable%20Sheet%20Name%20and%20Dynamic%20Cell%20Reference%20Based%20on%202%20Drop%20Down%20Validations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2113830%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F954494%22%20target%3D%22_blank%22%3E%40cpatomba%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERestructuring%20your%20data%20for%20analysis%20is%20a%20good%20option.%3C%2FP%3E%3CP%3EGiven%20what%20you%20have%2C%20traditional%20Excel%20is%20likely%20to%20produce%20an%20error-prone%20mess.%26nbsp%3B%20Both%20Excel%20365%20and%20Power%20Query%20offer%20sensible%20ways%20forward.%3C%2FP%3E%3CP%3EFor%20365%2C%20I%20would%20identify%20the%20data%20for%20each%20State%20with%20a%20sheet%20scoped%20defined%20name.%26nbsp%3B%20The%20task%20of%20the%20INDIRECT%20formula%20is%20then%20to%20return%20data%20for%20the%20State%20using%20a%20fully%20qualified%20name.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20LET(%0A%20%20%20stateData%2C%20INDIRECT(state%26amp%3B%22!data%22)%2C%0A%20%20%20n%2C%20XMATCH(Product%2C%20stateData)%2C%0A%20%20%20IFERROR(INDEX(stateData%2C%20n%2B%7B2%3B3%3B4%7D)%2C%20%7B%22Not%20stocked%22%3B%22%22%3B%22%22%7D)%0A%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThe%20picture%20also%20shows%20a%20product%20list%20for%20a%20validation%20dropdown%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20570px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F252236iB07015ADABD4B627%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2113708%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Lookup%20to%20Variable%20Sheet%20Name%20and%20Dynamic%20Cell%20Reference%20Based%20on%202%20Drop%20Down%20Validations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2113708%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F954494%22%20target%3D%22_blank%22%3E%40cpatomba%3C%2FA%3E%26nbsp%3BIf%20possible%2C%20collect%20all%20your%20sales%20transactions%20into%20one%20single%20table.%20Dedicate%20one%20column%20for%20the%20State.%20Then%20you%20can%20easily%20summarise%20the%20data%20using%20pivot%20tables%20or%20filters.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have 50 separate tabs of sales data, with each tab representing sales data for a single state.

 

On each of the 50 tabs, I have sales data for multiple products.  Each product has information such as sales price, discounts, etc.  The structure of each of the 50 state sales tab is like this below in a vertical format (I have upwards of 20 unique products but just listing 2 as an example).  There is spacing between the name of each Product and the product specific amounts such as sales price and discounts that cannot be removed as it contains other product specific data.  However, there is uniformity for each Product listing (i.e. there is always 2 rows that separate the name of the Product and the Sales Price for that product).

 

Product A

 

Sales   $50

Discount $25

Net Sales $25

 

Product B

 

Sales $55

Discount $25

Net Sales $30

 

I would like to create a Summary table that has two drop down validations.  The 1st data validation is the State Abbreviation.  The 2nd data validation will be the name of the product (i.e. Product A or Product B as in the example above).  Based on these two data validations, I would like to be able to go to the appropriate state sales data tab and the specific cell reference that has the data.  

 

So far, I have thought about using some combination of:

1) INDIRECT - Refer to the State Abbreviation drop down validation so I can pull the appropriate state tab as I change the drop down

2) CONCATENATE or &

3) CELL/ADDRESS Function - Use this to refer to the exact cell reference that will have this information on each tab.  For example, if I wanted to find Product A's sale price in each state, it would always be in let's say Cell B4 on every single state tab.

 

So far, the best I have been able to do is to get to something along these lines:

=INDIRECT("'"&$C$3&"!"&ADDRESS(3,2)), where $C$3 is referring to my State Abbreviation Dropdown.  I don't know how to be able to create a dynamic cell reference lookup in the last part with the address function.  I was thinking of creating a table that has the row and column number that I could lookup to but don't even know where I am going with this.

 

Any direction would be appreciated.  Thanks!

4 Replies

@cpatomba If possible, collect all your sales transactions into one single table. Dedicate one column for the State. Then you can easily summarise the data using pivot tables or filters.

best response confirmed by cpatomba (New Contributor)
Solution

@cpatomba 

Restructuring your data for analysis is a good option.

Given what you have, traditional Excel is likely to produce an error-prone mess.  Both Excel 365 and Power Query offer sensible ways forward.

For 365, I would identify the data for each State with a sheet scoped defined name.  The task of the INDIRECT formula is then to return data for the State using a fully qualified name.

= LET(
   stateData, INDIRECT(state&"!data"),
   n, XMATCH(Product, stateData),
   IFERROR(INDEX(stateData, n+{2;3;4}), {"Not stocked";"";""})
  )

The picture also shows a product list for a validation dropdown

image.png

@Riny_van_Eekelen Thanks.  I have tried to restructure the data and right now it is looking like this.  The idea is the same just changed my drop downs to city and division.  Trying to use a combination of index, match and concatenate right now to retrieve the restructured data which is now residing in one single tab inside of 50 tabs.

 

 

@Peter Bartholomew PowerQuery is a great suggestion here.  Will give it a try also to see what kind of results I may get.