Data validation and INDIRECT to pull only selected data from a single worksheet onto another

Rob Atron

New Member
Joined
Jul 1, 2013
Messages
2
Hi there,

Background

I'm an indie game developer working on a spreadsheet (Excel 2007) which defines how different ingredients can be mixed in various ways to create different potions.

Source worksheets

Data for each ingredient is included in a separate source worksheet, that I'll call ingredient worksheets. Within these ingredient worksheets, each column defines a different property for the ingredient (e.g. healing, sedative, etc.), with the potency of every property in numerical form in that column. As shown below, these use a slightly unusual layout, because each property has three possible ways of acting: positively (e.g. healing), negatively (e.g. poison), or neutralising (e.g. antidote). At the moment these three property types are included in separate rows, labelled: "pos", "neg" and "neut".

I've simplified the spreadsheets considerably, but the ingredient worksheet looks something like this (e.g. for the ingredient: "Fireweed Seed"):

IngredientstypeHealingSedative
Fireweed Seedpos80
neut
neg
10

<tbody>
</tbody>

Master worksheet

Apart from the ingredient worksheets, I also have one master worksheet, which is basically a sandbox for testing out different ingredient combinations. As it is at the moment, I can select multiple ingredients to add to this ‘cauldron’ using data validation dropdown menus. I then use INDIRECT to reference the relevant ingredient worksheets and pull the data from those required ingredient worksheets into the master worksheet. The master worksheet then calculates the properties of the resulting potion (not shown below).

The master worksheet (without any calculations) looks something like this:

IngredientstypeHealingSedative
Fireweed Seedpos80
neut
neg
10
Nonepos
neut
neg
Nonepos
neut
neg

<tbody>
</tbody>

NOTE: the names in blue in the Ingredients column above are selectable using dropdown menus. So if - as above - I set one dropdown as "Fireweed Seed" then it pulls the data from the "Fireweed Seed" ingredients workbook. "None" references a blank worksheet.

The problem

This all works very nicely. The only problem with this system is that we plan to add many more ingredients in the future, and this will mean having a lot of worksheets.

So, I would like to know how it might be possible to instead have all the ingredient data inside a single worksheet, but still allow the master worksheet to pull only data regarding the ingredients selected using the dropdown menus.

NOTE: the three-row (pos/neut/neg) layout is ideal for the master worksheet because of the calculations involved, and it was only used in the ingredient worksheets to keep the layout and cell references the same. If possible I would like to keep it that way, but if that just complicates things then I am prepared to change it so that all data for one ingredient is included on one row.


Many thanks
Rob
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Rob,

Welcome to MrExcel.

Here is some food for thought, maybe.

The dropdown list is populated from Ingredients sheet column A by defining the range, naming the range or dynamic range. Whatever suits.

Then you could retain the current format of your ingredients by listing in columns eg C:F.

On that basis, the formula in B2 wil copy across and down to get your selected ingredient properties.


Excel 2007
ABCDEF
1IngredientsIngredienttypehealingsedative
2NoneNone
3FireWeed Seed
4Bird Seed
5LinseedFireWeed Seedpos80
6Aniseedneut
7neg10
8Bird Seedpos20
9neut
10neg30
11Linseedpos2
12neut
13neg98
14Aniseedpos70
15neut
16neg10
Ingredients



Excel 2007
ABCD
1IngredientstypeHealingSedative
2FireWeed Seedpos80
3neut
4neg10
5Linseedpos2
6neut
7neg98
8None
9
10
Master
Cell Formulas
RangeFormula
B2=OFFSET(Ingredients!$C$1,MATCH(INDIRECT("$A"&(COUNTA($A$2:$A2)*3)-1),Ingredients!$C:$C,0)+(MOD(ROWS($A$2:$A4),3)-1),COLUMNS($B:B))
Named Ranges
NameRefers ToCells
Ingredients=Ingredients!$A$2:$A$6


It would be similar but probably be more simple to have the ingredients data in single rows.

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,215,541
Messages
6,125,413
Members
449,223
Latest member
Narrian

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