How can I write the COUNTIFS function only one time when it comes to different conditions?

Dezom

New Member
Joined
Jul 21, 2020
Messages
21
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi Everyone,

I put here the table for your perception.

Week 1-2-3-4 => January
Week 4-5-6 => Febraury
I am here calculating total job concept type numbers at each month.

How I am solving it currently is a bit time-consuming. Therefore I want to improve that formula that I am using.
What I want is to write Countif formulas only one time combining all weeks in one formula instead of writing it seperately like below. (But I do not want to make changings in raw data table like adding months instead of weeks, I want to solve it with formula itself) How would we achieve that?
Thanks you very much

Countifs question.xlsx
ABCDEFGH
1WorkerWeekConceptDuration
2John1.weekCorrection20Correction
3John1.weekMK20January1.week 2.week 3.week 4.week1
4Tomas1.weekMK20February5.week 6.week 7.week4
5Karhan2.weekMK20
6Dennis1.weekMK12
7Kylee2.weekSK12
8Tomas6.weekSK20
9John2.weekSK12
10Mattheus3.weekSK12
11Dennis3.weekSK12
12Markus3.weekSK20
13Tomas4.weekNew Work14
14Karhan4.weekNew Work2
15Mattheus4.weekNew Work4
16Karhan4.weekNew Work2
17Karhan5.weekCorrection14
18John5.weekCorrection5
19Kylee5.weekCorrection3
20Kylee5.weekCorrection6
21Kylee5.weekNew Work2
22Jonnathan5.weekNew Work0
23Daniel5.weekSecond work22
24Solomon6.weekProduction Sequence3
25John6.weekSecond work15
26Mattheus6.weekNew Work18
27Kylee7.weekNew Work10
28Dennis7.weekSecond work14
29Solomon7.weekNew Work14
30Jonnathan7.weekNew Work14
Data
Cell Formulas
RangeFormula
H3H3=COUNTIFS(C2:C30,H2,B2:B30,"1.week")+COUNTIFS(C2:C30,H2,B2:B30,"2.week")+COUNTIFS(C2:C30,H2,B2:B30,"3.week")+COUNTIFS(C2:C30,H2,B2:B30,"4.week")
H4H4=COUNTIFS($C$2:$C$30,$H$2,$B$2:$B$30,"5.week")+COUNTIFS($C$2:$C$30,$H$2,$B$2:$B$30,"6.week")+COUNTIFS($C$2:$C$30,$H$2,$B$2:$B$30,"7.week")
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
One option with slight change to the sheet
+Fluff New.xlsm
ABCDEFGH
1WorkerWeekConceptDuration
2John1.weekCorrection20WeekCorrection
3John1.weekMK20January41
4Tomas1.weekMK20February74
5Karhan2.weekMK20
6Dennis1.weekMK12
7Kylee2.weekSK12
8Tomas6.weekSK20
9John2.weekSK12
10Mattheus3.weekSK12
11Dennis3.weekSK12
12Markus3.weekSK20
13Tomas4.weekNew Work14
14Karhan4.weekNew Work2
15Mattheus4.weekNew Work4
16Karhan4.weekNew Work2
17Karhan5.weekCorrection14
18John5.weekCorrection5
19Kylee5.weekCorrection3
20Kylee5.weekCorrection6
21Kylee5.weekNew Work2
22Jonnathan5.weekNew Work0
23Daniel5.weekSecond work22
24Solomon6.weekProduction Sequence3
25John6.weekSecond work15
26Mattheus6.weekNew Work18
27Kylee7.weekNew Work10
28Dennis7.weekSecond work14
29Solomon7.weekNew Work14
30Jonnathan7.weekNew Work14
Temp
Cell Formulas
RangeFormula
H3:H4H3=SUMPRODUCT(($C$2:$C$30=$H$2)*(--LEFT($B$2:$B$30,FIND(".",$B$2:$B$30)-1)<=G3)*(--LEFT($B$2:$B$30,FIND(".",$B$2:$B$30)-1)>N(G2)))
 
Upvote 0
Not sure if this is what you are after

=COUNTIFS($C$2:$C$30,$K$2,$B$2:$B$30,G3:J3)
Enter as an array, Ctrl, Shift & Enter

1595704195060.png
 
Upvote 0
Ignore mine, on testing further it does not work correctly.

This should work
=SUM(COUNTIFS($C$2:$C$30,$K$2,$B$2:$B$30,G3:J3))
Enter as an array.
 
Upvote 0
One option with slight change to the sheet
+Fluff New.xlsm
ABCDEFGH
1WorkerWeekConceptDuration
2John1.weekCorrection20WeekCorrection
3John1.weekMK20January41
4Tomas1.weekMK20February74
5Karhan2.weekMK20
6Dennis1.weekMK12
7Kylee2.weekSK12
8Tomas6.weekSK20
9John2.weekSK12
10Mattheus3.weekSK12
11Dennis3.weekSK12
12Markus3.weekSK20
13Tomas4.weekNew Work14
14Karhan4.weekNew Work2
15Mattheus4.weekNew Work4
16Karhan4.weekNew Work2
17Karhan5.weekCorrection14
18John5.weekCorrection5
19Kylee5.weekCorrection3
20Kylee5.weekCorrection6
21Kylee5.weekNew Work2
22Jonnathan5.weekNew Work0
23Daniel5.weekSecond work22
24Solomon6.weekProduction Sequence3
25John6.weekSecond work15
26Mattheus6.weekNew Work18
27Kylee7.weekNew Work10
28Dennis7.weekSecond work14
29Solomon7.weekNew Work14
30Jonnathan7.weekNew Work14
Temp
Cell Formulas
RangeFormula
H3:H4H3=SUMPRODUCT(($C$2:$C$30=$H$2)*(--LEFT($B$2:$B$30,FIND(".",$B$2:$B$30)-1)<=G3)*(--LEFT($B$2:$B$30,FIND(".",$B$2:$B$30)-1)>N(G2)))

thanks Fluff, that works
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

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