Formula to first find and then sum

Chris Mcarthur

New Member
Joined
Jan 30, 2019
Messages
16
I have a workbook with tabs 1 - 31 representing the days of the month.
On each sheet we have employees name, ID, start time, date, and Comments. I currently have a Summary sheet that pulls over the ID and Comment, if any.

What I now need is something to total, if a person (ID) has a comment, how many comments include the word - "sick", how many are "early" and how many do they have that include the word "late".

so for example: ID 542 has 4 early, 2 late, 0 sick ( for the month of February)
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Can you post some sample data so we can workout a solution?
 
Upvote 0
[TABLE="width: 895"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]February[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]1[/TD]
[TD="colspan: 2"]2[/TD]
[TD="colspan: 2"]3[/TD]
[TD="colspan: 2"]4[/TD]
[/TR]
[TR]
[TD]ID[/TD]
[TD]Comment[/TD]
[TD]ID[/TD]
[TD]Comments[/TD]
[TD]ID[/TD]
[TD]Comments[/TD]
[TD]ID[/TD]
[TD]Comments[/TD]
[/TR]
[TR]
[TD]447[/TD]
[TD][/TD]
[TD]299[/TD]
[TD][/TD]
[TD]638[/TD]
[TD]10 mins early[/TD]
[TD]786[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]449[/TD]
[TD][/TD]
[TD]729[/TD]
[TD][/TD]
[TD]450[/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]638[/TD]
[TD][/TD]
[TD]300[/TD]
[TD]24 mins late[/TD]
[TD]451[/TD]
[TD][/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]450[/TD]
[TD]12 mins early[/TD]
[TD]598[/TD]
[TD][/TD]
[TD]705[/TD]
[TD][/TD]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]451[/TD]
[TD][/TD]
[TD]758[/TD]
[TD][/TD]
[TD]536[/TD]
[TD][/TD]
[TD]9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]705[/TD]
[TD][/TD]
[TD]301[/TD]
[TD][/TD]
[TD]452[/TD]
[TD][/TD]
[TD]619[/TD]
[TD]18 mins early'[/TD]
[/TR]
[TR]
[TD]536[/TD]
[TD][/TD]
[TD]742[/TD]
[TD][/TD]
[TD]453[/TD]
[TD][/TD]
[TD]709[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]452[/TD]
[TD][/TD]
[TD]683[/TD]
[TD][/TD]
[TD]861[/TD]
[TD][/TD]
[TD]831[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]453[/TD]
[TD][/TD]
[TD]690[/TD]
[TD][/TD]
[TD]568[/TD]
[TD][/TD]
[TD]832[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]861[/TD]
[TD][/TD]
[TD]305[/TD]
[TD][/TD]
[TD]776[/TD]
[TD]24 mins early[/TD]
[TD]826[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]937[/TD]
[TD][/TD]
[TD]307[/TD]
[TD][/TD]
[TD]463[/TD]
[TD][/TD]
[TD]14[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]568[/TD]
[TD][/TD]
[TD]820[/TD]
[TD][/TD]
[TD]466[/TD]
[TD][/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]776[/TD]
[TD]45 mins early[/TD]
[TD]309[/TD]
[TD]30 mins early[/TD]
[TD]468[/TD]
[TD][/TD]
[TD]673[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]463[/TD]
[TD][/TD]
[TD]661[/TD]
[TD]45 mins early[/TD]
[TD]865[/TD]
[TD][/TD]
[TD]17[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]926[/TD]
[TD]24 mins early[/TD]
[TD]312[/TD]
[TD][/TD]
[TD]899[/TD]
[TD][/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]466[/TD]
[TD][/TD]
[TD]701[/TD]
[TD][/TD]
[TD]792[/TD]
[TD][/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]468[/TD]
[TD][/TD]
[TD]316[/TD]
[TD][/TD]
[TD]472[/TD]
[TD][/TD]
[TD]663[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]865[/TD]
[TD][/TD]
[TD]319[/TD]
[TD][/TD]
[TD]880[/TD]
[TD][/TD]
[TD]660[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]899[/TD]
[TD][/TD]
[TD]320[/TD]
[TD]18 mins early[/TD]
[TD]851[/TD]
[TD][/TD]
[TD]662[/TD]
[TD]
Ok this is a sample of the summary tab it picks up the ID# of each employee and any comments from all tabs 1st, 2nd, etc

I will send over a sample of the first tab.

[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
[TABLE="width: 920"]
<colgroup><col span="5"></colgroup><tbody>[TR]
[TD]ID[/TD]
[TD]Name[/TD]
[TD]Start Time[/TD]
[TD]Date[/TD]
[TD]Comment[/TD]
[/TR]
[TR]
[TD]447[/TD]
[TD]Sidhu Satwinder[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]449[/TD]
[TD]Sidhu Surinder[/TD]
[TD]7:45 Dep[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]638[/TD]
[TD]Simmi Simmi[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]450[/TD]
[TD]Singh Baljinder[/TD]
[TD]3:30 PM Fed P[/TD]
[TD]y[/TD]
[TD]12 mins early[/TD]
[/TR]
[TR]
[TD]451[/TD]
[TD]Singh Balvir[/TD]
[TD]2:45 Fed[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]705[/TD]
[TD]Singh Daljit[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]536[/TD]
[TD]Singh Deep Pal[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]452[/TD]
[TD]Singh Gurlal[/TD]
[TD]R[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]453[/TD]
[TD]Singh Gurleen[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]861[/TD]
[TD]Singh Gurpratap[/TD]
[TD]<strike>9:30 FIll</strike>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]937[/TD]
[TD]Singh Harmanpreet[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]568[/TD]
[TD]Singh Inderpal[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]776[/TD]
[TD]Singh Ishadeep[/TD]
[TD]330pm F Lead[/TD]
[TD]y[/TD]
[TD]45 mins early[/TD]
[/TR]
[TR]
[TD]463[/TD]
[TD]Singh Paramjit[/TD]
[TD]7:45 Line[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]926[/TD]
[TD]Singh Satbir[/TD]
[TD]3:30pm Fed P[/TD]
[TD]y[/TD]
[TD]24 mins early[/TD]
[/TR]
[TR]
[TD]466[/TD]
[TD]Singh Vir[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]468[/TD]
[TD]Skuratow Tamara[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]865[/TD]
[TD]Sran Sukhdeep[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]899[/TD]
[TD]Suyo Conrado[/TD]
[TD]8:00 am Cheese[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]792[/TD]
[TD]Takhar Kulwinder[/TD]
[TD]2:30 Bake[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]472[/TD]
[TD]Takhar Sukhjit[/TD]
[TD]-[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]880[/TD]
[TD]Tariq Durr E Sameen[/TD]
[TD]8:00 Pack[/TD]
[TD]y[/TD]
[TD]12 mins early[/TD]
[/TR]
[TR]
[TD]851[/TD]
[TD]Tatla Rupinder[/TD]
[TD]6:15 Oven[/TD]
[TD]y[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi Chris,

Maybe this could help? Use a helper table to find & convert full comments into Early/Late or Sick this has to be repeated for all the other tabs.

Then we can add all of the countifs together,


Book1
ABCDEFGHIJK
1IDNameStart TimeDateCommentEarlyLateSickEarlyLateSick
2447Sidhu Satwinder  
3449Sidhu Surinder7:45 Depy
4638Simmi Simmi1
5450Singh Baljinder3:30 PM Fed Py12 mins earlyEarly2
6451Singh Balvir2:45 Fedy
7705Singh Daljit
8536Singh Deep Pal
9452Singh GurlalR
10453Singh Gurleen
11861Singh Gurpratap9:30 FIll
12937Singh Harmanpreet
13568Singh Inderpal
14776Singh Ishadeep330pm F Leady45 mins earlyEarly3
15463Singh Paramjit7:45 Liney
16926Singh Satbir3:30pm Fed Py24 mins earlyEarly2
17466Singh Vir
18468Skuratow Tamara
19865Sran Sukhdeep
20899Suyo Conrado8:00 am Cheesey
21792Takhar Kulwinder2:30 Bakey
22472Takhar Sukhjit-
23880Tariq Durr E Sameen8:00 Packy12 mins earlyEarly1
24851Tatla Rupinder6:15 Oveny
253001
Summary
Cell Formulas
RangeFormula
F2=IF(ISNUMBER(SEARCH(F$1,$E2)),F$1,"")
I2=COUNTIFS($A$2:$A$25,Summary!$A2,$F$2:$F$25,Summary!F$1)+COUNTIFS('1'!$A$2:$A$25,Summary!$A2,'1'!C$2:C$25,Summary!F$1)+COUNTIFS('2'!$A$2:$A$25,Summary!$A2,'2'!C$2:C$25,Summary!F$1)+COUNTIFS('3'!$A$2:$A$25,Summary!$A2,'3'!C$2:C$25,Summary!F$1)+COUNTIFS('4'!$A$2:$A$25,Summary!$A2,'4'!C$2:C$25,Summary!F$1)



Book1
ABCDE
1IDCommentEarlyLateSick
2447 
3449
4638
545012 mins earlyEarly
6451
7705
8536
9452
10453
11861
12937
13568
1477645 mins earlyEarly
15463
1692624 mins earlyEarly
17466
18468
19865
20899
1
Cell Formulas
RangeFormula
C2=IF(ISNUMBER(SEARCH(C$1,$B2)),C$1,"")
 
Upvote 0
hi RasGhul,

so How can I read the whole "countif" formula? its cut off and did you have to type it or is there a way to autofill?

thank-you
Chris
 
Upvote 0
Hi Chris,

Just zoom out the mrexcel page so you can see the whole formula, note that the formula needs to be expanded to how many sheets you are counting (31?)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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