Having issue with SUMIFS()

DeGeorge

New Member
Joined
Jan 29, 2024
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I'm trying to sum a range based on multiple other columns.

I want to sum C3:C41 if G3:G41 = "Payment" and Month of B3:B41 = "4" and Year of B3:B41 = "2019"

So I tried this =SUMIFS(C3:C41,G3:G41,"Payment",Month(B3:B41),"4",Year(B3:B41),"2019"), and it won't resolve.

Separately, Month(B3:B41) returns an array of the months of the dates in that range. Year(B3:B41) returns an array of years of the dates in that range. When I add the criteria for month or year, I get TRUE or FALSE but it only works on 1 cell at at time, not a range. I get a spill range.

I'm guessing that Month() and Year() can't be used as criteria in a SUMIFS because of the spill?

Any ideas? Thanks!
 
Why not use a pivot table ?
In terms of a formula is your Month column a date or text ?
(If you are not sure change the format to a different date format or to General if nothing changes its text if it changes its a date - ctrl+Z to put it back if it does change)
Also please provide the sheet name for the data sheet and if its an excel table the table name.
 
Upvote 0
I am login off for the night. Assuming your month is actually a date and your sheet for the data is Sheet2, try the below.
Since your headings are plural (Payments) and your transaction type is singular (Payment) I have had to trim the "s" off your heading to use as criteria

20240324 SumIfs Date Range DeGeorge v02.xlsx
ABC
1MonthPaymentsDeposits
2April 2019(372.94)268.99
3May 2019(284.16)6,832.28
4June 2019(464.07)2,864.00
5July 2019--
6August 2019--
7September 2019--
Sheet1
Cell Formulas
RangeFormula
B2:C7B2=LET(yr,YEAR($A2), mth,MONTH($A2), tranType,LEFT(B$1,LEN(B$1)-1), SUMIFS(Sheet2!$B$2:$B$42,Sheet2!$C$2:$C$42,tranType,Sheet2!$A$2:$A$42,">="&DATE(yr,mth,1),Sheet2!$A$2:$A$42,"<"&DATE(yr,mth+1,1)))


If your month is a date then it could be simplified to this:
Excel Formula:
=LET(dt,$A2,
            tranType,LEFT(B$1,LEN(B$1)-1),
            SUMIFS(Sheet2!$B$2:$B$42,Sheet2!$C$2:$C$42,tranType,Sheet2!$A$2:$A$42,">="&dt,Sheet2!$A$2:$A$42,"<="&EOMONTH(dt,0)))

Hi Alex

Month is a date field with custom format mmmm yyyy. So, the values of each are 4/1/2019, 5/1/2019, etc.

Let me play with what you sent me. Have a good night and thanks!

Jim
 
Upvote 0
Fluff & Alex

Both solutions worked, however Fluff's solution is a little easier to manipulate. Thank you both for your help with this! I really appreciate it.
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Fluff and Alex

Both solutions worked, however Fluff's solution is a little easier to manipulate. Thank you both for your help with this! I really appreciate it.
 
Upvote 0
Would an option where you didn't need to copy anywhere, just put in the top row be worth considering?
DeGeorge.xlsm
BCD
1DateAmountComments
21/04/2019($25.71)Payment
31/04/2019($7.99)Payment
43/04/2019($241.92)Payment
53/04/2019$150.00Deposit
65/04/2019$107.00Deposit
75/04/2019$11.99Deposit
88/04/2019($53.40)Payment
98/04/2019($9.59)Payment
109/04/2019($34.33)Payment
112/05/2019($45.00)Payment
122/05/2019$25.00Deposit
132/05/2019($12.22)Payment
142/05/2019$35.00Deposit
1517/05/2019($6.93)Payment
1620/05/2019($79.73)Payment
1721/05/2019$6,336.00Deposit
1811/12/2023($200.32)Payment
1922/05/2019($118.01)Payment
2028/05/2019($2.90)Payment
2130/05/2019$436.00Deposit
2230/05/2019($19.37)Payment
2331/05/2019$0.28Deposit
243/06/2019($76.15)Payment
253/06/2019$364.00Deposit
263/06/2019($31.74)Payment
274/06/2019($47.50)Payment
285/06/2019($95.00)Payment
295/06/2019$765.00Deposit
305/06/2019($28.50)Payment
3110/06/2019($108.16)Payment
3210/06/2019$679.00Deposit
3310/06/2019($26.80)Payment
3410/06/2019$345.00Deposit
3510/06/2019($19.99)Payment
3610/06/2019($12.79)Payment
3710/06/2019($12.78)Payment
3810/06/2019$234.00Deposit
391/03/2023($100.16)Payment
4012/06/2019$234.00Deposit
4112/06/2019$243.00Deposit
4213/06/2019($4.66)Payment
Sheet1


DeGeorge.xlsm
ABC
1MonthPaymentsDeposits
2Apr-19($372.94)$268.99
3May-19($284.16)$6,832.28
4Jun-19($464.07)$2,864.00
5Jul-19$0.00$0.00
6Aug-19$0.00$0.00
7Sep-19$0.00$0.00
Sheet2
Cell Formulas
RangeFormula
B2:B7B2=BYROW(A2:A7,LAMBDA(r,SUM(FILTER(Sheet1!C2:C42,(TEXT(Sheet1!B2:B42,"my")=TEXT(r,"my"))*(Sheet1!D2:D42="Payment"),0))))
C2:C7C2=BYROW(A2:A7,LAMBDA(r,SUM(FILTER(Sheet1!C2:C42,(TEXT(Sheet1!B2:B42,"my")=TEXT(r,"my"))*(Sheet1!D2:D42="Deposit"),0))))
Dynamic array formulas.

Frank

This is awesome! I never knew anything like this could be done. Need to read up on LAMBDA!
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,933
Members
449,480
Latest member
yesitisasport

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