Summing values across multiple columns, searching for first column in range

davidpfitz

New Member
Joined
May 11, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Can anyone help me with the following problem?

I have a data structure like below, except that it's a lot wider and goes from the previous Monday to 365 days out across the width of it. There are about 1200 rows of data.

11/5/2020
11/5/202012/5/202013/5/202014/5/202015/5
100%50%10%0%100%
50%20%0%0%50%

Currently, this formula searches the % data for the date in A1 and returns the sum of that column of data - 150%.

=SUM(INDEX(A3:D4,,MATCH(A1,A2:D2,0)))

However I need it so sum up the entire week (i.e. the date in A1 + the next 4 days to make a 5 day working week), so would want it to return 380%.

I know this would be simple if the exact range was known, but it's not - I want it parameterised by A1.

Or even more ideally, I would like to be able to give a start date and an end date and then be given the sum of all the data between those dates.

Anyone got experience doing something like this?

Thank you.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the forum.

Try

=SUMPRODUCT(($A$2:$E$2>=$A$1)*($A$2:$E$2<=$B$1)*(A3:E4))

1589214477795.png


1589214542165.png
 
Upvote 0
Welcome to the forum.

Try

=SUMPRODUCT(($A$2:$E$2>=$A$1)*($A$2:$E$2<=$B$1)*(A3:E4))

View attachment 13593

View attachment 13594

Thank you - I have been struggling with that all day. That is such a nice and elegant way of doing it. I am massively grateful and will now have to go away and learn how SUMPRODUCT works because that is insanely useful.

Thanks again - you have saved me from (probably futilely) working really late tonight.

David.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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