Match columns in SUMPRODUCT INDEX MATCH formula

Rainmanne

Board Regular
Joined
Mar 10, 2016
Messages
132
Office Version
  1. 2013
Platform
  1. Windows
I have two worksheets. One has the source table:

1676645201169.png


And another has an aggregation table:

1676645288670.png


To get the numbers from the first table to the second I use the following formula:

Excel Formula:
=SUMPRODUCT(INDEX(FS!$A$2:$Z$250,0,MATCH(C$1,FS!$A$1:$Z$1,0)),--(FS!$B$2:$B$250=$A2))/1000

It basically checks the year in the result table, matches it with the year in the source table to determine the column with the result, then checks Table ID in the result table and matches it with the Table ID in the column B in the source table. If there are multiple entries for the Table ID in the source table, they are summed up.

But now I need to match the column with the Table ID header instead of having a static column B because I need to use the same table to various types of source tables, where Table ID might be in different column.

But I cannot figure out where to put something like
Excel Formula:
MATCH("Table ID", FS!$A$1:$Z$1,0)
to identify the column.

Could someone help please?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How about
Excel Formula:
=SUMPRODUCT(INDEX(FS!$A$2:$Z$250,0,MATCH(C$1,FS!$A$1:$Z$1,0)),--(INDEX(FS!$A$2:$Z$250,0,MATCH("Table ID",FS!$A$1:$Z$1,0))=$A2))/1000
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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