Check Pattern with VBA

ejpoke

New Member
Joined
Apr 24, 2017
Messages
6
[TABLE="width: 500"]
<tbody>[TR]
[TD]EMP ID[/TD]
[TD]EMP Name
[/TD]
[TD]Date[/TD]
[TD]Job[/TD]
[TD]JOB #[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]John[/TD]
[TD]1/1/17[/TD]
[TD]Manager[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]John[/TD]
[TD]1/2/17[/TD]
[TD]Manager[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]John[/TD]
[TD]1/3/17[/TD]
[TD]Employee[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Mary[/TD]
[TD]1/1/17[/TD]
[TD]Employee[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Mary[/TD]
[TD]1/2/17[/TD]
[TD]Employee[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Peter[/TD]
[TD]1/3/17[/TD]
[TD]Manager[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Paul[/TD]
[TD]1/4/17[/TD]
[TD]Employee[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]


Hello all-

I am creating a converter for payroll files pulled from POS data. I need to write a VBA code that checks that the same employee is clocked in as the same job for the date range. So in this example Employee #1 John is the only employee in violation because during this period he has two unique jobs (Manager and Employee). I would like a msgbox to pop up stating that employee #1 John is in violation of the policy so the person entering data can fix the incorrect entry manually. Some employees will have only 1 row (just one day of working ilke Peter and Paul) some will have multiple (like Mary and John). The report pulls with both a numerical and string value for each employee and job type.

Appreciate any feedback!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Wanted to bump this back up.

My gut is to concatenate columns A and E then run a loop to see if there are any discrepancies. So any concatenated "code" that starts with 1 should be followed by more 1's than 2's. Please let me know if I am approaching this the right way

Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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