Index and Match or similar

Access Beginner

Active Member
Joined
Nov 8, 2010
Messages
311
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I have below some test data. Which in my version at work is a Pivot Table ( based on over 300,000 rows of data). The data is linked to a query in Access and when new data is imported and the pivot table is refreshed, values of 'Subject may' change. Once the new data has been updated in the Pivot Table, I copy the whole sheet and replace as values, thus removing the Pivot Table and leaving a static table. The raw data is then deleted, as the file is over 250MB with the data included, which is why I cannot use the power of a Pivot Table when sending the document up the chain.

What I do with this is then, create a dynamic table, which is used to create a chart, so a user can select his/her Region and the chart will update.

My issue, as the values of Subject may change, using a vlookup, means I will have to update the column number in each of the formulas. I had used Index and Match, but I cannot get it to work with 3 criteria.

This is a small example of the data, there could be up to 25 subjects and the subject numbers may vary from week to week. My data is run weekly.

I hope I have been clear.



Test data as below


Excel 2010
BCDEFGH
4FemaleFemaleFemaleMaleMaleMale
5Region NameSubject 1Subject 2Subject 3Subject 1Subject 3Subject 5
6Region 11202159514933875641306
7Region 2328536846633741625
8Region 3166915521765135112771190
9Region 4627151254211431091749
10Region 5136715106402474921852
11Region 6751263194512271441181
12Region 714744421219153112931808
13Region 81265411106510321820409
14Region 96511565173527001972
15Region 10148114938316548551164
16Region 111659145964613451049290
17Region 12582149414491843108555
18Region 13196312091698571906974
19Region 1419331013118513767151830
20Region 151369104417471262101049
21Region 16176063016791467285816
22All Regions191091770119875173691325717270
23
24Expected results when All Regions is selected ( data validation)
25FemaleFemaleFemaleMaleMaleMale
26Subject 1Subject 2Subject 3Subject 1Subject 3Subject 5
27All Regions191091770119875173691325717270
Sheet1
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi,

Perhaps try something like this for your 3 criteria match:

Sheet1[TABLE="class: html-maker-worksheet"]
<thead>[TR]
[TH][/TH]
[TH]A[/TH]
[TH]B[/TH]
[TH]C[/TH]
[TH]D[/TH]
[TH]E[/TH]
[TH]F[/TH]
[TH]G[/TH]
[/TR]
</thead><tbody>[TR]
[TH]1[/TH]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TH]2[/TH]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TH]3[/TH]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TH]4[/TH]
[TD][/TD]
[TD]Female[/TD]
[TD]Female[/TD]
[TD]Female[/TD]
[TD]Male[/TD]
[TD]Male[/TD]
[TD]Male[/TD]
[/TR]
[TR]
[TH]5[/TH]
[TD]Region Name[/TD]
[TD]Subject 1[/TD]
[TD]Subject 2[/TD]
[TD]Subject 3[/TD]
[TD]Subject 1[/TD]
[TD]Subject 3[/TD]
[TD]Subject 5[/TD]
[/TR]
[TR]
[TH]6[/TH]
[TD]Region 1[/TD]
[TD="align: right"]1202[/TD]
[TD="align: right"]1595[/TD]
[TD="align: right"]1493[/TD]
[TD="align: right"]387[/TD]
[TD="align: right"]564[/TD]
[TD="align: right"]1306[/TD]
[/TR]
[TR]
[TH]7[/TH]
[TD]Region 2[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]853[/TD]
[TD="align: right"]684[/TD]
[TD="align: right"]663[/TD]
[TD="align: right"]374[/TD]
[TD="align: right"]1625[/TD]
[/TR]
[TR]
[TH]8[/TH]
[TD]Region 3[/TD]
[TD="align: right"]1669[/TD]
[TD="align: right"]1552[/TD]
[TD="align: right"]1765[/TD]
[TD="align: right"]1351[/TD]
[TD="align: right"]1277[/TD]
[TD="align: right"]1190[/TD]
[/TR]
[TR]
[TH]9[/TH]
[TD]Region 4[/TD]
[TD="align: right"]627[/TD]
[TD="align: right"]1512[/TD]
[TD="align: right"]542[/TD]
[TD="align: right"]1143[/TD]
[TD="align: right"]1091[/TD]
[TD="align: right"]749[/TD]
[/TR]
[TR]
[TH]10[/TH]
[TD]Region 5[/TD]
[TD="align: right"]1367[/TD]
[TD="align: right"]1510[/TD]
[TD="align: right"]640[/TD]
[TD="align: right"]247[/TD]
[TD="align: right"]492[/TD]
[TD="align: right"]1852[/TD]
[/TR]
[TR]
[TH]11[/TH]
[TD]Region 6[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]1263[/TD]
[TD="align: right"]1945[/TD]
[TD="align: right"]1227[/TD]
[TD="align: right"]1441[/TD]
[TD="align: right"]181[/TD]
[/TR]
[TR]
[TH]12[/TH]
[TD]Region 7[/TD]
[TD="align: right"]1474[/TD]
[TD="align: right"]442[/TD]
[TD="align: right"]1219[/TD]
[TD="align: right"]1531[/TD]
[TD="align: right"]1293[/TD]
[TD="align: right"]1808[/TD]
[/TR]
[TR]
[TH]13[/TH]
[TD]Region 8[/TD]
[TD="align: right"]1265[/TD]
[TD="align: right"]411[/TD]
[TD="align: right"]1065[/TD]
[TD="align: right"]1032[/TD]
[TD="align: right"]1820[/TD]
[TD="align: right"]409[/TD]
[/TR]
[TR]
[TH]14[/TH]
[TD]Region 9[/TD]
[TD="align: right"]651[/TD]
[TD="align: right"]1565[/TD]
[TD="align: right"]1735[/TD]
[TD="align: right"]270[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1972[/TD]
[/TR]
[TR]
[TH]15[/TH]
[TD]Region 10[/TD]
[TD="align: right"]1481[/TD]
[TD="align: right"]149[/TD]
[TD="align: right"]383[/TD]
[TD="align: right"]1654[/TD]
[TD="align: right"]855[/TD]
[TD="align: right"]1164[/TD]
[/TR]
[TR]
[TH]16[/TH]
[TD]Region 11[/TD]
[TD="align: right"]1659[/TD]
[TD="align: right"]1459[/TD]
[TD="align: right"]646[/TD]
[TD="align: right"]1345[/TD]
[TD="align: right"]1049[/TD]
[TD="align: right"]290[/TD]
[/TR]
[TR]
[TH]17[/TH]
[TD]Region 12[/TD]
[TD="align: right"]582[/TD]
[TD="align: right"]1494[/TD]
[TD="align: right"]1449[/TD]
[TD="align: right"]1843[/TD]
[TD="align: right"]1085[/TD]
[TD="align: right"]55[/TD]
[/TR]
[TR]
[TH]18[/TH]
[TD]Region 13[/TD]
[TD="align: right"]1963[/TD]
[TD="align: right"]1209[/TD]
[TD="align: right"]1698[/TD]
[TD="align: right"]571[/TD]
[TD="align: right"]906[/TD]
[TD="align: right"]974[/TD]
[/TR]
[TR]
[TH]19[/TH]
[TD]Region 14[/TD]
[TD="align: right"]1933[/TD]
[TD="align: right"]1013[/TD]
[TD="align: right"]1185[/TD]
[TD="align: right"]1376[/TD]
[TD="align: right"]715[/TD]
[TD="align: right"]1830[/TD]
[/TR]
[TR]
[TH]20[/TH]
[TD]Region 15[/TD]
[TD="align: right"]1369[/TD]
[TD="align: right"]1044[/TD]
[TD="align: right"]1747[/TD]
[TD="align: right"]1262[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]1049[/TD]
[/TR]
[TR]
[TH]21[/TH]
[TD]Region 16[/TD]
[TD="align: right"]1760[/TD]
[TD="align: right"]630[/TD]
[TD="align: right"]1679[/TD]
[TD="align: right"]1467[/TD]
[TD="align: right"]285[/TD]
[TD="align: right"]816[/TD]
[/TR]
[TR]
[TH]22[/TH]
[TD]All Regions[/TD]
[TD="align: right"]19109[/TD]
[TD="align: right"]17701[/TD]
[TD="align: right"]19875[/TD]
[TD="align: right"]17369[/TD]
[TD="align: right"]13257[/TD]
[TD="align: right"]17270[/TD]
[/TR]
[TR]
[TH]23[/TH]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TH]24[/TH]
[TD][/TD]
[TD]Expected results when All Regions is selected ( data validation)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TH]25[/TH]
[TD][/TD]
[TD]Female[/TD]
[TD]Female[/TD]
[TD]Female[/TD]
[TD]Male[/TD]
[TD]Male[/TD]
[TD]Male[/TD]
[/TR]
[TR]
[TH]26[/TH]
[TD][/TD]
[TD]Subject 1[/TD]
[TD]Subject 2[/TD]
[TD]Subject 3[/TD]
[TD]Subject 1[/TD]
[TD]Subject 3[/TD]
[TD]Subject 5[/TD]
[/TR]
[TR]
[TH]27[/TH]
[TD]All Regions[/TD]
[TD="align: right"]19109[/TD]
[TD="align: right"]17701[/TD]
[TD="align: right"]19875[/TD]
[TD="align: right"]17369[/TD]
[TD="align: right"]13257[/TD]
[TD="align: right"]17270[/TD]
[/TR]
</tbody>[/TABLE]
Excel 2010

CellFormula
B27=INDEX(4:22,MATCH($A27,$A$4:$A$22,0),MATCH(B$25&B$26,INDEX(4:4&5:5,0),0))

<tbody>
[TD="bgcolor: #FFFFFF"] Worksheet Formulas [TABLE="class: html-maker-worksheet"]
<thead>[TR]

</thead><tbody>
</tbody>
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
thanks for that, worked perfectly.

=INDEX(4:22.... part of the formula is referencing A4 to A22? Haven't seen cell referenced like that before, but then again, I'm still learning Excel.

Once again thanks :-)
 
Upvote 0
thanks for that, worked perfectly.

=INDEX(4:22.... part of the formula is referencing A4 to A22? Haven't seen cell referenced like that before, but then again, I'm still learning Excel.

Once again thanks :-)
Your welcome! No - the 4:22 references the whole of those rows. E.g. if your last column is XFD then it would be similar to A4:XFD22
 
Upvote 0

Forum statistics

Threads
1,223,738
Messages
6,174,213
Members
452,551
Latest member
croud

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