Cyberpunk001
New Member
- Joined
- Aug 27, 2018
- Messages
- 13
Good day Excel forum,
I need the help of an expert to solve a puzzling and challenging problem.
I will try to explain in the shortest way possible, but need to be thorough to explain in clarity.
In the table below, I have need of a formula in the "Code" column to do some very specific calculations regarding multiple criteria as outlined in the steps below.
[TABLE="width: 750, align: left"]
<tbody>[TR]
[TD]Emp ID[/TD]
[TD]Weeknum[/TD]
[TD]Hours[/TD]
[TD]Over[/TD]
[TD]Code[/TD]
[TD]Hours2[/TD]
[TD]Helper[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]1[/TD]
[TD]2.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]2.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]8[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]2[/TD]
[TD]9[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]9[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]3[/TD]
[TD]4.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]4.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]3[/TD]
[TD]4.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]4.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]4[/TD]
[TD]9.75[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]9.75[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]4[/TD]
[TD]1.5[/TD]
[TD]5.75[/TD]
[TD]2?[/TD]
[TD]5.75[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]6[/TD]
[TD]11[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]6.75[/TD]
[TD]55[/TD]
[/TR]
</tbody>[/TABLE]
Formula breakdown
1) Step 1 sum all hours by Emp ID and weeknum not equal to 7
2) Step 2 calculate overtime by summing difference between sum of hours and over column and deposit in "over" column
3) Step 3 check in "hours" column if a value exists which is the same as the "over" column, return TRUE, FALSE
4) step 4 if step 3 is TRUE, find the row where this value is stored in "hours" column and deposit value in same row of column "Hours2"
5) step 5 return code 1 in all rows for emp ID in column "Code" except for the value obtained in step 4, use code 2 instead
6) if a value for "over" does not exist in the "hours" column, replace the minimum value found for emp ID with real number in "Hours2" column from value in "over column"
7) step 7 replace maximum value in "Hours" column for Emp ID with 45-(helper column value-over value-max value in list)
8) return code 1 in all rows for Emp ID except the value obtained for "over" column, use code 2 instead
Any help will be greatly appreciated
I need the help of an expert to solve a puzzling and challenging problem.
I will try to explain in the shortest way possible, but need to be thorough to explain in clarity.
In the table below, I have need of a formula in the "Code" column to do some very specific calculations regarding multiple criteria as outlined in the steps below.
[TABLE="width: 750, align: left"]
<tbody>[TR]
[TD]Emp ID[/TD]
[TD]Weeknum[/TD]
[TD]Hours[/TD]
[TD]Over[/TD]
[TD]Code[/TD]
[TD]Hours2[/TD]
[TD]Helper[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]1[/TD]
[TD]2.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]2.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]8[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]2[/TD]
[TD]9[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]9[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]3[/TD]
[TD]4.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]4.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]3[/TD]
[TD]4.5[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]4.5[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]4[/TD]
[TD]9.75[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]9.75[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]4[/TD]
[TD]1.5[/TD]
[TD]5.75[/TD]
[TD]2?[/TD]
[TD]5.75[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]1010x[/TD]
[TD]6[/TD]
[TD]11[/TD]
[TD]5.75[/TD]
[TD]1?[/TD]
[TD]6.75[/TD]
[TD]55[/TD]
[/TR]
</tbody>[/TABLE]
Formula breakdown
1) Step 1 sum all hours by Emp ID and weeknum not equal to 7
2) Step 2 calculate overtime by summing difference between sum of hours and over column and deposit in "over" column
3) Step 3 check in "hours" column if a value exists which is the same as the "over" column, return TRUE, FALSE
4) step 4 if step 3 is TRUE, find the row where this value is stored in "hours" column and deposit value in same row of column "Hours2"
5) step 5 return code 1 in all rows for emp ID in column "Code" except for the value obtained in step 4, use code 2 instead
6) if a value for "over" does not exist in the "hours" column, replace the minimum value found for emp ID with real number in "Hours2" column from value in "over column"
7) step 7 replace maximum value in "Hours" column for Emp ID with 45-(helper column value-over value-max value in list)
8) return code 1 in all rows for Emp ID except the value obtained for "over" column, use code 2 instead
Any help will be greatly appreciated