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

#### MurrayBarn

##### New Member
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 Name Code All Branches All Brazil 70 Cape Town 60 Head Office 00 Kimberley 40 Middelburg 20 Randburg 10 Richards Bay 50 Rustenburg 30 Training 80

 Cost Centre Name Code Admin 01 All divisions All DEF 00 Detector Assembly 10 Electronic Design 15 Engineering 20 Fabrication 25 Field Service 30 General Assembly 35 ISO 80 MARK 70 Mechanical Design 40 Pack & Crating 55 Paint & Sand 45 PCB Assembly 60 Prod 09 Quality Control 65 Research & Development 85 Sales 99 Stores 05 Testing 90

### 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
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
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
The * is a wild card meaning (in this case) any text value.

Replies
5
Views
66
Replies
3
Views
175
Replies
12
Views
303
Replies
7
Views
196
Replies
1
Views
345

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.

### Which adblocker are you using?

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

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