Hi,
Thanks for showing interest in this post.
I have 2 excel sheets one of which has entire database and 2nd sheet contains day-wise production data as below
Sheet 1: Database
[TABLE="width: 500"]
<tbody>[TR]
[TD]Month[/TD]
[TD]Date[/TD]
[TD]Emp_ID[/TD]
[TD]Emp_Name[/TD]
[TD]Attendance Status[/TD]
[TD]Task1[/TD]
[TD]Production for Task1 (PD1)[/TD]
[TD]Task2[/TD]
[TD]Production for Task2 (PD2)[/TD]
[TD]Task3[/TD]
[TD]Production for Task3 (PD3)[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5673[/TD]
[TD]John[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]30[/TD]
[TD]Survey_2[/TD]
[TD]55[/TD]
[TD]Survey_1[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5675[/TD]
[TD]Michele[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]27[/TD]
[TD]Survey_2[/TD]
[TD]56[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5734[/TD]
[TD]Ethen[/TD]
[TD]Present[/TD]
[TD]Survey_3[/TD]
[TD]56[/TD]
[TD]Survey_1[/TD]
[TD]32[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5673[/TD]
[TD]John[/TD]
[TD]Present[/TD]
[TD]Survey_3[/TD]
[TD]42[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5675[/TD]
[TD]Michele[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]53[/TD]
[TD]Survey_3[/TD]
[TD]23[/TD]
[TD]Survey_1[/TD]
[TD]113[/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5734[/TD]
[TD]Ethen[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]22[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 2: Day-Wise Production stats
[TABLE="width: 500"]
<tbody>[TR]
[TD]Month Filter[/TD]
[TD]June[/TD]
[TD]Task Filter[/TD]
[TD]Survey_1[/TD]
[/TR]
[TR]
[TD]Emp_ID[/TD]
[TD]30/6/18[/TD]
[TD]01/7/18[/TD]
[TD]02/7/18[/TD]
[/TR]
[TR]
[TD]5673[/TD]
[TD]67[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5675[/TD]
[TD]27[/TD]
[TD]166[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5734[/TD]
[TD]32[/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
For this i am using 2 formulas (1st- to get a unique list of Emp_IDs who worked in the given task on a given day with this formula:
{=IFERROR(INDEX(Database[Emp_ID],
MATCH(0,
IF(Task Filter=Database[Task1],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
IF(Task Filter=Database[Task2],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
IF(Task Filter=Database[Task3],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
""))),0)),"")}
And to calculate Production for the unique list for a particular task, i am using this below SUMIFS Array formula
{=IF(
(SUMIFS(Database[PD1],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task1],$D$1)+
SUMIFS(Database[PD2],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task2],$D$1)+
SUMIFS(Database[PD3],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task3],$D$1)}
Now the challenge is that the database is huge (Almost 30000 Rows and 7 type of tasks) and these formulas are making the sheet too slow.
Please suggest if there is any fast way to do it. Or any VBA code. Actually i am new to VBA world. Thanks
Thanks for showing interest in this post.
I have 2 excel sheets one of which has entire database and 2nd sheet contains day-wise production data as below
Sheet 1: Database
[TABLE="width: 500"]
<tbody>[TR]
[TD]Month[/TD]
[TD]Date[/TD]
[TD]Emp_ID[/TD]
[TD]Emp_Name[/TD]
[TD]Attendance Status[/TD]
[TD]Task1[/TD]
[TD]Production for Task1 (PD1)[/TD]
[TD]Task2[/TD]
[TD]Production for Task2 (PD2)[/TD]
[TD]Task3[/TD]
[TD]Production for Task3 (PD3)[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5673[/TD]
[TD]John[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]30[/TD]
[TD]Survey_2[/TD]
[TD]55[/TD]
[TD]Survey_1[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5675[/TD]
[TD]Michele[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]27[/TD]
[TD]Survey_2[/TD]
[TD]56[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]June[/TD]
[TD]30/6/18[/TD]
[TD]5734[/TD]
[TD]Ethen[/TD]
[TD]Present[/TD]
[TD]Survey_3[/TD]
[TD]56[/TD]
[TD]Survey_1[/TD]
[TD]32[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5673[/TD]
[TD]John[/TD]
[TD]Present[/TD]
[TD]Survey_3[/TD]
[TD]42[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5675[/TD]
[TD]Michele[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]53[/TD]
[TD]Survey_3[/TD]
[TD]23[/TD]
[TD]Survey_1[/TD]
[TD]113[/TD]
[/TR]
[TR]
[TD]July[/TD]
[TD]01/7/18[/TD]
[TD]5734[/TD]
[TD]Ethen[/TD]
[TD]Present[/TD]
[TD]Survey_1[/TD]
[TD]22[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 2: Day-Wise Production stats
[TABLE="width: 500"]
<tbody>[TR]
[TD]Month Filter[/TD]
[TD]June[/TD]
[TD]Task Filter[/TD]
[TD]Survey_1[/TD]
[/TR]
[TR]
[TD]Emp_ID[/TD]
[TD]30/6/18[/TD]
[TD]01/7/18[/TD]
[TD]02/7/18[/TD]
[/TR]
[TR]
[TD]5673[/TD]
[TD]67[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5675[/TD]
[TD]27[/TD]
[TD]166[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5734[/TD]
[TD]32[/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
For this i am using 2 formulas (1st- to get a unique list of Emp_IDs who worked in the given task on a given day with this formula:
{=IFERROR(INDEX(Database[Emp_ID],
MATCH(0,
IF(Task Filter=Database[Task1],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
IF(Task Filter=Database[Task2],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
IF(Task Filter=Database[Task3],IF(Month Filter=Database[Month],COUNTIF($A$2:A2,Database[Emp_ID])),
""))),0)),"")}
And to calculate Production for the unique list for a particular task, i am using this below SUMIFS Array formula
{=IF(
(SUMIFS(Database[PD1],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task1],$D$1)+
SUMIFS(Database[PD2],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task2],$D$1)+
SUMIFS(Database[PD3],Database[Emp_ID],A3:A5,Database[Date],B2:B3,Database[Task3],$D$1)}
Now the challenge is that the database is huge (Almost 30000 Rows and 7 type of tasks) and these formulas are making the sheet too slow.
Please suggest if there is any fast way to do it. Or any VBA code. Actually i am new to VBA world. Thanks