Using INDEX and refering to a Drop down

umaks

New Member
Joined
Dec 28, 2017
Messages
2
Hi, I basically want to create a drop down where you can select an age group and it simply lists the top 20 medical conditions in one column, number of admissions last year and this year, in the next two columns.

Basically I have five tables by age group - 20s, 30s, 40s, 50s, 60s

For each table, the column headings are Medical Condition (where the rows contain the list of the types of conditions), column 2016/17 YTD (rows containing the number of admissions for each condition), and column 2017/18 YTD (again, listing the number of admissions for each condition).

I have created Defined Name for each of the five tables - (I.e defined names are the age groups).

I then created a drop down list of the Defined Names - (which are the five age groups).

I now want to create a separate table which includes the list of top 20 medical conditions (and corresponding activity) for whichever age group you select from the toggle.

I thought it would be as simple as doing =index($b$4,3,1), where $B$4 refers to drop down which contains the Defined names (I.e the age group) I have just created. The 3 would refer to the third row, and 1 referring to the first column.
(I would have therefore created a whole table so then it would refer to the exact position, but the data would change according to the drop down toggle).
Why does it not pick up $B$4 as the array or Defined name.

How else can I crack this nut? Your help would be much appreciated :)
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Make sure your Defined names match up exactly with your dropdown list.

I just made an example sheet, with 3 named ranges, "Test", "Test2" and "Test3". I made a data validation dropdown in B1 from a list of "Test", "Test2" and "Test3" and when I use

Code:
=index(indirect(B4),2,2)

and switch between the data validation options it works correctly. I tried with different row and column numbers, and all works fine.
 
Last edited:
Upvote 0
ajamess has put his finger on the main problem. But if you want the list of conditions to be listed in order, you might need some additional formulas. For example:

BCDEFGHIJ
120s
2Medical Condition2016/17 YTD2017/18 YTD
3Age RangeTop 20 ConditionsCountAcne18
4TwentiesCholera25Stubbed toe1423
5Malaria25Flu2015
6Year RangeStubbed toe23Asthma617
72017/18 YTDHayfever19Hayfever119
8Asthma17Bad hair day1317
9Bad hair day17Broken leg127
10Flu15Cholera1125
11Acne8Malaria925
12Broken leg7Dizziness231
13Dizziness1

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
E4=IFERROR(LARGE(INDEX(INDIRECT($B$4),0,MATCH($B$7,INDEX(INDIRECT($B$4),1,0),0)),ROWS($E$4:$E4)),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D4{=IF(E4="","",INDEX(INDIRECT($B$4),SMALL(IF(INDEX(INDIRECT($B$4),0,MATCH($B$7,INDEX(INDIRECT($B$4),1,0),0))=E4,ROW(INDEX(INDIRECT($B$4),0,1))-ROW(INDEX(INDIRECT($B$4),1,1))+1),COUNTIF($E$4:$E4,E4)),1))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>




The range H2:J100 has a named range of "Twenties". The other age ranges are defined just the same. In B4 is your drop down list for the age range, and in B7 I put in a drop down for the year. With those in place, you can use the formulas in E4 and D4 to get the list of conditions, sorted by frequency. It will dynamically change as you change the dropdowns in B4 and B7. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,215,509
Messages
6,125,216
Members
449,215
Latest member
texmansru47

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