SUMIFS all data if criteria range 1 and 2 = "All" otherwise based on the criteria selected

MurrayBarn

New Member
Joined
May 27, 2012
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi There

I have a set of data that I am using two ranges as criteria as per the below tables. The data is summarised in Branch and Cost Centre names. The user chooses a Dropdown for each Branch and then Cost Centre. I can successfully calculate the SUMIFS if anything other than All is selected. So If I want Cape Town and Electronic Design, SUMIFS works well.

However, if the user selects say Cape Town and All, SUMIFS returns zero as it cannot find All in the second criteria range.

Is there a way that will cause Excel to ignore part of the SUMIFS function if All is selected, in other words if All is selected for Criteria 2, how do I get Excel to sum all the data based on criteria range 2? If say Cape Town and Engineering are chosen, the formula would be something like =-SUMIFS(Data!AJ:AJ,Data!$I:$I,Report!F$1,Data!$J:$J,Report!F$2) where ReportF1 = 60 and ReportF2 = 20. Now the user wants to see the results for all Brnaches and Divisions and chooses All for both. How do I get Excel to eliminate the sections for Criteria 1 and 2 or get it to convert "All" into everything?


Branch NameCode
All BranchesAll
Brazil70
Cape Town60
Head Office00
Kimberley40
Middelburg20
Randburg10
Richards Bay50
Rustenburg30
Training80

Cost Centre NameCode
Admin01
All divisionsAll
DEF00
Detector Assembly10
Electronic Design15
Engineering20
Fabrication25
Field Service30
General Assembly35
ISO80
MARK70
Mechanical Design40
Pack & Crating55
Paint & Sand45
PCB Assembly60
Prod09
Quality Control65
Research & Development85
Sales99
Stores05
Testing90
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,861
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=-SUMIFS(Data!AJ:AJ,Data!$I:$I,IF(F$1="All","*",F$1),Data!$J:$J,IF(F$2="All","*",F$2))
 

MurrayBarn

New Member
Joined
May 27, 2012
Messages
28
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=-SUMIFS(Data!AJ:AJ,Data!$I:$I,IF(F$1="All","*",F$1),Data!$J:$J,IF(F$2="All","*",F$2))

Thats fantastic, thank you. What is the "*" called so I can read up on it?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,861
Office Version
  1. 365
Platform
  1. Windows
The * is a wild card meaning (in this case) any text value.
 

Forum statistics

Threads
1,136,205
Messages
5,674,396
Members
419,506
Latest member
mpazr001

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