Simplify this formula containing sum(countifs() function

gfdwer2

New Member
Joined
Jan 22, 2020
Messages
24
Office Version
  1. 2016
  2. 2010
Platform
  1. MacOS
I NEED THIS FORMULA TO BE SIMPLIFIED BECAUSE IT TAKES A LOT OF TIME FOR EXCEL TO COMPUTE IT

Simple background, I need to count all the cells containing "OT 1","OT 2","OT 3","OT 4","OT 5","OT 6" from 7 columns (PROC1-7) , but only for a specific date (represented by A5)

=SUM(COUNTIFS(DATE,A5,PROC1,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC2,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC3,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC4,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC5,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC6,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))+SUM(COUNTIFS(DATE,A5,PROC7,{"OT 1","OT 2","OT 3","OT 4","OT 5","OT 6"}))

FROM THE FORMULA ABOVE:
1. DATE is a range selection which is Column A from different sheet (DATA)
2. Content of Cell A5 is the first criteria I am looking for in range DATE
3. PROC1 is a range selection which is Column H from different sheet (DATA)
PROC2 is a range selection which is Column K from different sheet (DATA)
PROC3 - PROC7 so on and so forth
4. "OT 1" - "OT 6" are the text I am looking for in range PROC1-PROC7

I have to separate EACH PROC (Column H, Column K, so on so forth) because excel does not allow me to use all the columns at once like H:Z

sample excel sheet can be found in this link: sample.1.xlsm
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
you should limit your name ranges DATE, PROC1 etc close to the numbers expected, e.g. A1:A100.

atm, you're checking over 1 million rows for 10+ items each of the PROC
 
Upvote 0
What other values might they contain other than OT 1 to OT 7 inclusive?
 
Upvote 0
Do you have any other values beginning with "OT" that you don't want included?
 
Upvote 0
you should limit your name ranges DATE, PROC1 etc close to the numbers expected, e.g. A1:A100.

atm, you're checking over 1 million rows for 10+ items each of the PROC
I GET YOUR POINT THERE
 
Upvote 0
What other values might they contain other than OT 1 to OT 7 inclusive?
Only OT 1 to OT 7, no other value or text included in a cell with OT 1 to OT 7 since they are special codes.
 
Upvote 0
ideally try this, but replace D3:J23 with a single range that spans Proc1-Proc7. I assume that there are as many rows in DATE as there are in PROC?

=SUMPRODUCT(--((DATE)*{1,1,1,1,1,1,1}=A5),--((D3:J23="OT1")+(D3:J23="OT2")+(D3:J23="OT3")+(D3:J23="OT4")+(D3:J23="OT5")+(D3:J23="OT6")))

PS, as far a I know there is no reason why you can't have a single named range covering all 7 columns, even if they are the entire column. Though as said previously its not clever to reference an entire column because of the size of the calculation involved.

HTH
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,762
Members
449,048
Latest member
excelknuckles

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