Sum over an array based on date in row and unique identifier in column

LisaPal

New Member
Joined
Mar 31, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am looking for a formula to put in cells B2:F7 on Sheet 2.

Notes
- This is a simplified version of the file I am actually working with. The file I am working with has all work-day dates (Mon-Fri) in row 2 on Sheet 1, for 01/01/2021 to 30/06/2022.
- Each Trade Reference is unique, so there are no duplicates.

What I want the formula on Sheet 2 to do, is;
- Look at Sheet 1
- - Sum over B3:R7 for all dates that relate to the relevant month, and the relevant Trade Reference

E.g.
Formula for cell B4 (sheet 2) = find Trade Reference 2 on Sheet 1, and sum up all entries on Sheet 1 that fall between cell B2 and cell C3 on Sheet 2 (i.e. 01/01/21 - 31/01/21).
So here the formula would return all values that appear in cells B4:G4 on Sheet 1 = 1000

Thanks in advance,

Lisa
 

Attachments

  • Sheet1.PNG
    Sheet1.PNG
    17.4 KB · Views: 5
  • Sheet2.PNG
    Sheet2.PNG
    11.5 KB · Views: 3

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,252
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=SUMPRODUCT((Sheet1!$A$3:$A$10=$A3)*(Sheet1!$B$2:$R$2>=B$2)*(Sheet1!$B$2:$R$2<=EOMONTH(B$2,0))*(Sheet1!$B$3:$R$10))
 
Solution

LisaPal

New Member
Joined
Mar 31, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=SUMPRODUCT((Sheet1!$A$3:$A$10=$A3)*(Sheet1!$B$2:$R$2>=B$2)*(Sheet1!$B$2:$R$2<=EOMONTH(B$2,0))*(Sheet1!$B$3:$R$10))
That is exactly what I was after - I was playing around with SUMPRODUCT for a while but couldn't get the date to work.

Thanks so much Fluff!

:biggrin:
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,252
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,141,062
Messages
5,704,050
Members
421,325
Latest member
tapete86

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
Top