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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,948
Messages
6,175,568
Members
452,652
Latest member
eduedu

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