SUMPRODUCT of two arrays that match text in row headers and fall within date ranges in column headers?

mongkokman91

New Member
Joined
Jun 26, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a table whereby the column headers are dates for hourly pay raises (dummy data) and the row headers refer to types of staff, followed by a start and end date for the contract. Screenshot
for illustration. The contract starts on 2021-11-01 and lasts for three years. What I want to do is compute the weighted average pay rate of each staff type at the end of each contract year.

So SUMPRODUCT number of months btw 2021-11-01 to 2022-04-01, 2022-04-01 to 2022-10-01, etc. (i.e., {5,6,1}) and the corresponding rates {$15, $15.25, $15.5} divided by the sum of {5,6,1}. As I am unable to match SUMPRODUCT, DATEDIF and SUM functions (am I missing any formulas?) to my criteria successfully, I am turning to r/Excel for help. It'll be best if the solution doesn't involve unpivoting the table. The Excel version I'm using for this task doesn't have Power Query and people didn't like seeing the consolidated table in an unpivoted state anyway.

Thanks in advance for any assistance.🙏

Staff/Date2021-04-012021-11-012022-04-012022-10-012022-11-012023-04-012023-10-012024-04-012024-10-01
A$15.00$15.00$15.25$15.50$15.75$16.00$16.25$16.50$16.75
B$15.50$15.50$15.75$16.00$16.25$16.50$16.75$17.00$17.25
C$16.00$16.00$16.25$16.50$16.75$17.00$17.25$17.50$17.75
D$16.50$16.50$16.75$17.00$17.25$17.50$17.75$18.00$18.25
Start Date2021-11-01
End Date2022-11-01
StaffA
Get:{$15, $15.25, $15.5}
2021-04-01 and 2021-11-01 are the same because pay was previously raised on an annual basis so 2022-04-01
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: get_an_array_of_values_that_fall_between_two
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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