Hello everyone!
I am working on simplifying our employee benefit reconcile process at work. With over 500 employees and 16 different enrollment options, the current reconcile process is messy and prone to errors.
I've created a flow in Power Automate Desktop (PAD) that allows the user to upload a payroll report and carrier invoice. The flow cleans up the data from the two files and writes and saves it to an Excel Workbook. I plan to use PAD to manipulate Macro Enabled Worksheet and heavily reduce the amount of user input.
That being said, the workbook has two sheets, a payroll report and carrier invoice.
I am wanting to use VBA/Macro to compare both worksheets and export the variances to a template I built. I know there are a ton of posts on comparing two sheets, but I am needing the VBA to look at several columns to make comparisons.
For instance, an employee may be listed twice on the payroll report. Once for their health premium and once for their dental. The same can be said about the carrier invoice.
I need the VBA to look at the "Employee ID" column between both sheet and then look at the "Product Column" to see if it's for health or dental. Once it matches those two criteria, I need it to look at the "Cost" to see if there is a variance.
There should only be 3 things that would cause an employee to be on the variance sheet:
Sheet One- Payroll Report
Sheet Two- Carrier Invoice
New Workbook with Results
I am working on simplifying our employee benefit reconcile process at work. With over 500 employees and 16 different enrollment options, the current reconcile process is messy and prone to errors.
I've created a flow in Power Automate Desktop (PAD) that allows the user to upload a payroll report and carrier invoice. The flow cleans up the data from the two files and writes and saves it to an Excel Workbook. I plan to use PAD to manipulate Macro Enabled Worksheet and heavily reduce the amount of user input.
That being said, the workbook has two sheets, a payroll report and carrier invoice.
I am wanting to use VBA/Macro to compare both worksheets and export the variances to a template I built. I know there are a ton of posts on comparing two sheets, but I am needing the VBA to look at several columns to make comparisons.
For instance, an employee may be listed twice on the payroll report. Once for their health premium and once for their dental. The same can be said about the carrier invoice.
I need the VBA to look at the "Employee ID" column between both sheet and then look at the "Product Column" to see if it's for health or dental. Once it matches those two criteria, I need it to look at the "Cost" to see if there is a variance.
There should only be 3 things that would cause an employee to be on the variance sheet:
- The employee is on the payroll report but not on the invoice.
- The employee is on the invoice but not on the payroll report.
- There is a difference in what payroll deduction amount and what was on the carrier invoice. (Ideally, I would have it only show differences that were greater than$1.00)
Sheet One- Payroll Report
Sample Reconcile (1).xlsx | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | First Name | Last Name | Employee ID | Product | Employee Portion | Employer Portion | Total Premium | ||
2 | Luke | Skywalker | 1976 | Health | $ 25.00 | $ 475.00 | $ 500.00 | ||
3 | Luke | Skywalker | 1976 | Dental | $ 4.50 | $ 25.50 | $ 30.00 | ||
4 | Egon | Spengler | 1984 | Dental | $ 4.50 | $ 25.50 | $ 30.00 | ||
5 | Lloyd | Christmas | 1994 | Health | $50 | $650 | $700 | ||
6 | Lloyd | Christmas | 1994 | Dental | $6 | $34 | $40 | ||
7 | Clark | Griswald | 1983 | Health | $80 | $ 820.00 | $900 | ||
Sample Payroll Report |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G2:G7 | G2 | =SUM(E2,F2) |
Sheet Two- Carrier Invoice
Sample Reconcile (1).xlsx | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | First Name | Last Name | Employee ID | Product | Total Premium | ||
2 | Luke | Skywalker | 1976 | Health | $ 600.00 | ||
3 | Luke | Skywalker | 1976 | Dental | $ 30.00 | ||
4 | Egon | Spengler | 1984 | Dental | $ 30.00 | ||
5 | Lloyd | Christmas | 1994 | Health | $ 700.00 | ||
6 | Lloyd | Christmas | 1994 | Dental | $ 40.00 | ||
7 | Peter | McCallister | 1990 | Health | $ 800.00 | ||
8 | Peter | McCallister | 1990 | Dental | $ 100.00 | ||
Sample Carrier Invoice |
New Workbook with Results
Sample Reconcile (1).xlsx | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | First Name | Last Name | SSN | Product | Payroll Deduction | Inoivce Amount | Difference | Notes | ||
2 | Luke | Skywalker | 1976 | Health | $ 1,976.00 | $ 600.00 | $ (1,376.00) | |||
3 | Clark | Griswald | 1983 | Health | $ 900.00 | $ (900.00) | Missing from Invoice | |||
4 | Peter | McCallister | 1990 | Health | $ 800.00 | $ 800.00 | Missing Payroll Deduction | |||
5 | Peter | McCallister | 1990 | Dental | $ 100.00 | $ 100.00 | Missing Payroll Deduction | |||
Reconcile |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2 | E2 | =SUM(C2,D2) |
G2:G5 | G2 | =F2-E2 |