Lookup & Sum values between specific date periods

Izzy10

New Member
Joined
Jun 1, 2022
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

Please see below sample data set.
The columns are always going to be the same, but the rows will be dynamic each time a report is run.

Book1.xlsx
ABCDEFG
1Start01-May
2End07-May
3
4NoNameDateCategoryTypeDrCr
515Name101-MayEntertainment-200
690Name201-MaySupplies1500
745Name301-MayTravel -300
850Name402-MaySupplies50000
955Name502-MayTravel Car35
1057Name603-MaySupplies20
1156Name703-MayTravel30
1260Name805-MaySupplies3110
1363Name905-MaySupplies90
1465Name1010-MayEntertainment-50
1566Name1112-MaySupplies520
Data

"Data" sheet:
Sum of specified categories (Column D) - the amounts could be in either in Column F or Column G
Only for a specified date - between Start (B1) & End (B2)

Book1.xlsx
ABC
3CategoryTotal
4Entertainment-200
5Travel-235
6HR0
Calculation

"Calculation" sheet:
The sum to be calculated on this sheet

Additional notes:
If there is a category that is not in Column D of "Data sheet" (e.g. in this example "HR"), Column C of "Calucation" needs to show 0
Formula to capture data if the cell contains the words in Column D (e.g. if the category = Travel Car, it should still be included in the calculation)

Thank you!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
My apologies, I didn't mention in the original post that I was seeking help for a formula to calculate the sum. Thank you.
 
Upvote 0
I'm sure there must be a simpler method than this, but this might do until smarter people than me give you a more elegant solution (just adjust the sum range length to cover all possible values)

filter.xlsm
ABCD
1CategoryTotal
2Entertainment-200
3Travel-235
4HR0
5
Calculation
Cell Formulas
RangeFormula
C2:C4C2=SUMIFS(Data!$F$5:$F$1000,Data!$C$5:$C$1000,">="&Data!$B$1,Data!$C$5:$C$1000,"<="&Data!$B$2,Data!$D$5:$D$1000,"*"&Calculation!A2&"*")+SUMIFS(Data!$G$5:$G$1000,Data!$C$5:$C$1000,">="&Data!$B$1,Data!$C$5:$C$1000,"<="&Data!$B$2,Data!$D$5:$D$1000,"*"&Calculation!A2&"*")
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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