SUMIFS getting mostly correct value when using named ranges, but I need help to get it 100% right

ajnin

New Member
Joined
Apr 26, 2019
Messages
7
Office Version
  1. 2019
Platform
  1. Windows
Overview:

I would like to download a monthly CSV of my bank statement and paste it into excel. I then want to work out monthly costs for groups of Items. Example would be supermarkets. In the credit card dumb it might have 3 or 4 different super markets, and in the past I have been using a formula like this do work it out for January

=(SUMIFS(All!$B:$B,All!$A:$A,">=1/1/2019",All!$A:$A,"<=31/1/2019",All!$C:$C,"COLES*")+(SUMIFS(All!$B:$B,All!$A:$A,">=1/1/2019",All!$A:$A,"<=31/1/2019",All!$C:$C,"SAFEWAY*")+(SUMIFS(All!$B:$B,All!$A:$A,">=1/1/2019",All!$A:$A,"<=31/1/2019",All!$C:$C,"ALDI*"))))*-1

This works, but its not very nice and its a pain if I want to add a new supermarket. So I had the idea to create a named range with all the supermarkets and then use that in the formula.

So now I am using the formula

=SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops)*-1

I have 2 issues
Issue 1 - I have to list the shop 12 times or it does not work each month
Issue 2 - It only picks up the first shop

see below

this is only showing the MOnthly sum of the Coles and not Coles + IGA

TEST - Bills and Budget TEST.xlsx
AW
1YearSuper Markets
2Jan-23$333.52
3Feb-23$257.71
4Mar-23$568.16
5Apr-23$440.75
6May-23$604.50
7Jun-23$403.94
8Jul-23$410.35
9Aug-23$0.00
10Sep-23$251.55
11Oct-23$466.63
12Nov-23$418.66
13Dec-23$316.33
2023
Cell Formulas
RangeFormula
W2W2=SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops)*-1
W3W3=SUMIFS(New!$B:$B,New!$A:$A,">=1/2/2023",New!$A:$A,"<=28/2/2023",New!$C:$C,Shops)*-1
W4W4=SUMIFS(New!$B:$B,New!$A:$A,">=1/3/2023",New!$A:$A,"<=31/3/2023",New!$C:$C,Shops)*-1
W5W5=SUMIFS(New!$B:$B,New!$A:$A,">=1/4/2023",New!$A:$A,"<=30/4/2023",New!$C:$C,Shops)*-1
W6W6=SUMIFS(New!$B:$B,New!$A:$A,">=1/5/2023",New!$A:$A,"<=31/5/2023",New!$C:$C,Shops)*-1
W7W7=SUMIFS(New!$B:$B,New!$A:$A,">=1/6/2023",New!$A:$A,"<=30/6/2023",New!$C:$C,Shops)*-1
W8W8=SUMIFS(New!$B:$B,New!$A:$A,">=1/7/2023",New!$A:$A,"<=31/7/2023",New!$C:$C,Shops)*-1
W9W9=SUMIFS(New!$B:$B,New!$A:$A,">=1/8/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops)*-1
W10W10=SUMIFS(New!$B:$B,New!$A:$A,">=1/9/2023",New!$A:$A,"<=30/9/2023",New!$C:$C,Shops)*-1
W11W11=SUMIFS(New!$B:$B,New!$A:$A,">=1/10/2023",New!$A:$A,"<=31/10/2023",New!$C:$C,Shops)*-1
W12W12=SUMIFS(New!$B:$B,New!$A:$A,">=1/11/2023",New!$A:$A,"<=30/11/2023",New!$C:$C,Shops)*-1
W13W13=SUMIFS(New!$B:$B,New!$A:$A,">=1/12/2023",New!$A:$A,"<=31/12/2023",New!$C:$C,Shops)*-1
Named Ranges
NameRefers ToCells
New!_FilterDatabase=New!$A$1:$D$6651W2:W13
Shops=Items!$B$2:$B$25W2



TEST - Bills and Budget TEST.xlsx
B
1Coles
2*Coles*
3*Coles*
4*Coles*
5*Coles*
6*Coles*
7*Coles*
8*Coles*
9*Coles*
10*Coles*
11*Coles*
12*Coles*
13*Coles*
14*IGA*
15*IGA*
16*IGA*
17*IGA*
18*IGA*
19*IGA*
20*IGA*
21*IGA*
22*IGA*
23*IGA*
24*IGA*
25*IGA*
Items



If I change it up, now I will get correct Coles for January for Feb i cant work out how it came up with that vaule

TEST - Bills and Budget TEST.xlsx
AW
1YearSuper Markets
2Jan-23$333.52
3Feb-23$310.49
4Mar-23$0.00
5Apr-23$0.00
6May-23$0.00
7Jun-23$0.00
8Jul-23$0.00
9Aug-23$0.00
10Sep-23$0.00
11Oct-23$0.00
12Nov-23$0.00
13Dec-23$0.00
2023
Cell Formulas
RangeFormula
W2W2=SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops)*-1
W3W3=SUMIFS(New!$B:$B,New!$A:$A,">=1/2/2023",New!$A:$A,"<=28/2/2023",New!$C:$C,Shops)*-1
W4W4=SUMIFS(New!$B:$B,New!$A:$A,">=1/3/2023",New!$A:$A,"<=31/3/2023",New!$C:$C,Shops)*-1
W5W5=SUMIFS(New!$B:$B,New!$A:$A,">=1/4/2023",New!$A:$A,"<=30/4/2023",New!$C:$C,Shops)*-1
W6W6=SUMIFS(New!$B:$B,New!$A:$A,">=1/5/2023",New!$A:$A,"<=31/5/2023",New!$C:$C,Shops)*-1
W7W7=SUMIFS(New!$B:$B,New!$A:$A,">=1/6/2023",New!$A:$A,"<=30/6/2023",New!$C:$C,Shops)*-1
W8W8=SUMIFS(New!$B:$B,New!$A:$A,">=1/7/2023",New!$A:$A,"<=31/7/2023",New!$C:$C,Shops)*-1
W9W9=SUMIFS(New!$B:$B,New!$A:$A,">=1/8/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops)*-1
W10W10=SUMIFS(New!$B:$B,New!$A:$A,">=1/9/2023",New!$A:$A,"<=30/9/2023",New!$C:$C,Shops)*-1
W11W11=SUMIFS(New!$B:$B,New!$A:$A,">=1/10/2023",New!$A:$A,"<=31/10/2023",New!$C:$C,Shops)*-1
W12W12=SUMIFS(New!$B:$B,New!$A:$A,">=1/11/2023",New!$A:$A,"<=30/11/2023",New!$C:$C,Shops)*-1
W13W13=SUMIFS(New!$B:$B,New!$A:$A,">=1/12/2023",New!$A:$A,"<=31/12/2023",New!$C:$C,Shops)*-1
Named Ranges
NameRefers ToCells
New!_FilterDatabase=New!$A$1:$D$6651W2:W13
Shops=Items!$B$2:$B$25W2


TEST - Bills and Budget TEST.xlsx
B
1Coles
2*Coles*
3*IGA*
Items



I would like to have all coles and all iga added together for each respective month

the bank extract looks like

TEST - Bills and Budget TEST.xlsx
ABC
436027/02/2023-12COLES 0001
436227/02/2023-92.2COLES 0001 Area Name
437027/02/2023-21.01COLES 0001 Area Name
439322/02/2023-8.77Street name IGA Area Name
444514/02/2023-27.72COLES 0001 Area Name
447313/02/2023-34.08COLES EXPRESS 0001 Area Name
44869/02/2023-45.1COLES 0001 Area Name
45491/02/2023-25.6COLES 0001 Area Name
455731/01/2023-37.68COLES 0001 Area Name
457430/01/2023-145.7COLES 0001 Area Name
458030/01/2023-4.08Street name IGA Area Name
468716/01/2023-41.42COLES 0001 Area Name
469813/01/2023-9.67Street name IGA Area Name
469913/01/2023-9.67Street name IGA Area Name
47309/01/2023-13.04COLES 0001 Area Name
47409/01/2023-8.97Street name IGA Area Name
47419/01/2023-4.55Street name IGA Area Name
47644/01/2023-80.33COLES 0001 Area Name
47813/01/2023-15.35COLES 0001 Area Name
47983/01/2023-0.98Street name IGA Area Name
47993/01/2023-12.41Street name IGA Area Name
New
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Thank you. That is now updated.
 
Upvote 0
Thanks for that. (y)
How about
Excel Formula:
=-sumproduct(SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops))
 
Upvote 0
Thanks for that. (y)
How about
Excel Formula:
=-sumproduct(SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops))
Thank you. This really does help. I have applied it to January and February. It gives the correct value for Jan and Feb if I only have 1 item listed in Shops. If I add a second item Jan is correct, but I Feb is wrong. I cant even work out how its getting this vaule.

Jan Coles 333.52 (Correct)
Jan IGA 50.33
Jan Total 383.85

Feb Coles 257.71 (Correct)
Feb IGA 8.77
Feb Total 266.48

TEST - Bills and Budget TEST.xlsx
AW
1YearSuper Markets
2Jan-23$333.52
3Feb-23$257.71
2023
Cell Formulas
RangeFormula
W2W2= -SUMPRODUCT(SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops))
W3W3= -SUMPRODUCT(SUMIFS(New!$B:$B,New!$A:$A,">=1/2/2023",New!$A:$A,"<=28/2/2023",New!$C:$C,Shops))
Named Ranges
NameRefers ToCells
New!_FilterDatabase=New!$A$1:$D$6651W2:W3
Shops=Items!$B$2:$B$24W2:W3


List of items in "shops" zz is just filler

TEST - Bills and Budget TEST.xlsx
B
1Super Markets
2*Coles*
3zz
4zz
5zz
Items


SO when its like this everything is right. Once I add in *IGA* Jan has the right vaule, but Feb is wrong. I am expecting it to be Total 266.48

TEST - Bills and Budget TEST.xlsx
AW
1YearSuper Markets
2Jan-23$383.85
3Feb-23$568.20
2023
Cell Formulas
RangeFormula
W2W2= -SUMPRODUCT(SUMIFS(New!$B:$B,New!$A:$A,">=1/1/2023",New!$A:$A,"<=31/1/2023",New!$C:$C,Shops))
W3W3= -SUMPRODUCT(SUMIFS(New!$B:$B,New!$A:$A,">=1/2/2023",New!$A:$A,"<=28/2/2023",New!$C:$C,Shops))
Named Ranges
NameRefers ToCells
New!_FilterDatabase=New!$A$1:$D$6651W2:W3
Shops=Items!$B$2:$B$24W2:W3


TEST - Bills and Budget TEST.xlsx
B
1Super Markets
2*Coles*
3*IGA*
4zz
5zz
Items


Raw Data

TEST - Bills and Budget TEST.xlsx
ABC
436027/02/2023-12COLES 0001
436227/02/2023-92.2COLES 0001 Area Name
437027/02/2023-21.01COLES 0001 Area Name
439322/02/2023-8.77Street name IGA Area Name
444514/02/2023-27.72COLES 0001 Area Name
447313/02/2023-34.08COLES EXPRESS 0001 Area Name
44869/02/2023-45.1COLES 0001 Area Name
45491/02/2023-25.6COLES 0001 Area Name
455731/01/2023-37.68COLES 0001 Area Name
457430/01/2023-145.7COLES 0001 Area Name
458030/01/2023-4.08Street name IGA Area Name
468716/01/2023-41.42COLES 0001 Area Name
469813/01/2023-9.67Street name IGA Area Name
469913/01/2023-9.67Street name IGA Area Name
47309/01/2023-13.04COLES 0001 Area Name
47409/01/2023-8.97Street name IGA Area Name
47419/01/2023-4.55Street name IGA Area Name
47644/01/2023-80.33COLES 0001 Area Name
47813/01/2023-15.35COLES 0001 Area Name
47983/01/2023-0.98Street name IGA Area Name
47993/01/2023-12.41Street name IGA Area Name
New
 
Upvote 0
With that data I get 266.48 for Feb. Are you sure that there aren't any other rows for Feb that have IGA somewhere in the cell?
 
Upvote 0
With that data I get 266.48 for Feb. Are you sure that there aren't any other rows for Feb that have IGA somewhere in the cell?
I am rechecking, but I can see anything. I will make a new sheet
 
Upvote 0
With that data I get 266.48 for Feb. Are you sure that there aren't any other rows for Feb that have IGA somewhere in the cell?
Thank you @Fluff it was user error.

the formula you showed me works perfectly !!!

Thank you very much !!!
 
Upvote 0
Glad it's working & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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