How Can I Simplify the attached Formula -

Houstonking

New Member
Joined
Jul 12, 2016
Messages
41
Hello - How can i clean the below formula -

=SUM(COUNTIFS(State,{"CT","DE","PA","NJ","DC","MD","NH","OH"},Value,">10",OFFICE,"Name1"))+SUM(COUNTIFS(State,{"CT","DE","PA","NJ","DC","MD","NH","OH"},Value,">10",OFFICE,"Name2"))

Please help thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
There are several ways to shorten that formula, whether they are "cleaner" depends on your viewpoint.

ABC
12CTName1
22DEName2
32PA
42NJ
52DC
6MD
7NH
8OH

<tbody>
</tbody>
Sheet12

Worksheet Formulas
CellFormula
A1=SUM(COUNTIFS(State,{"CT","DE","PA","NJ","DC","MD","NH","OH"},Value,">10",Office,"Name1"))+SUM(COUNTIFS(State,{"CT","DE","PA","NJ","DC","MD","NH","OH"},Value,">10",Office,"Name2"))
A2=SUM(COUNTIFS(State,{"CT","DE","PA","NJ","DC","MD","NH","OH"},Value,">10",Office,{"Name1";"Name2"}))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
A3{=SUM(COUNTIFS(State,B1:B8,Value,">10",Office,"Name1"))+SUM(COUNTIFS(State,B1:B8,Value,">10",Office,"Name2"))}
A4{=SUM(COUNTIFS(State,B1:B8,Value,">10",Office,{"Name1","Name2"}))}
A5{=SUM(COUNTIFS(State,B1:B8,Value,">10",Office,TRANSPOSE(C1:C2)))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


A1 is your original formula.

A2 combines the two sections into 1 by putting Name1 and Name2 into an array constant. Notice the semicolon in that array. When you use 2 array constants in a SUMIFS, one must be commas (columns), and one must be semicolons (rows).

A3 takes the state array and puts it into the sheet. You need Control+Shift+Enter to handle that.

A4 and A5 are combinations of those techniques. Note in A5 how TRANSPOSE is used, so that one array is columnwise, and the other is rowwise.

Hope this helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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