Column Heading as reference with MATCH function VBA CODES

Fusky

New Member
Joined
Nov 17, 2016
Messages
15
ThisWorkbook.Sheets("Sheet1").Activate

Range("Sheet2!F8") = Application.Sum(Application.Index(Range("A:MN"), 0, Application.Match("Jack", Range("A2:MN2"), 0)))

End Sub

I have been working with a excel file with lot a data. So I have comeup with a VBA code(mentioned above) this will look for the column named “Jack” in sheet1 and will return the sum of the whole column in Sheet2 F8. But I would like to include one more MATCH function to this which is
Application.Match(“Salary_2010”,Range(B3:B50”)
Salary_2010(cell B) is basically rows and next to this I have each month. There are salary_2011,salary_2012 and so on. So basically im doing a summary table. So I would like to get the information like sum of salary_2010 jack got in Sheet2F8,salary_2011 in G8 and so on. I would like to refer to the column headings as the reference. Can somebody help me join this two match functions to get the outcome .Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Couldn't you use SUMIF for that?
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,512
Members
449,456
Latest member
SammMcCandless

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