Getting a macro to compare to lines of data.

markjohnson002

New Member
Joined
Jun 12, 2007
Messages
15
I have the ability to populate a report in excel, giving me two months worth of data for employees one after the other - if theres only one line then the employee is new. E.G
Excel Workbook
ABCDEFGH
5Employee No.Employee NameSalaryBasic DaysBasic HoursBasic PayBounty PaymentBounty Payment Gross
608100Person, A1625.000.000.000.000.000.00
609100Person, A1625.000.000.000.000.000.00
610200Person, B0.000.00222.000.000.000.00
611300Person, C1666.670.000.000.000.000.00
612300Person, C1666.670.000.000.000.000.00
613400Person, D0.000.001067.500.000.000.00
614400Person, D0.0073.501029.000.000.000.00
615500Person, E4066.670.000.000.000.000.00
616500Person, E4066.670.000.000.000.000.00
61733345Person, H2358.330.000.000.000.000.00
61833345Person, H2358.330.000.000.000.000.00
First Sheet


What i want to be able to do is press a button (macro) so that the document will insert a line everytime an employee has two months worth of data and subtract the top line from the bottom line to give me the differences. Rather like:
Excel Workbook
ABCDEFGH
5Employee No.Employee NameSalaryBasic DaysBasic HoursBasic PayBounty PaymentBounty Payment Gross
608100Person, A1625.000.000.000.000.000.00
609100Person, A1625.000.000.000.000.000.00
610*NO DIFFERENCE0.000.000.000.000.000.00
611200Person, B0.000.00222.000.000.000.00
612*NEW EMPLOYEE0.000.00222.000.000.000.00
613300Person, C1666.670.000.000.000.000.00
614300Person, C1666.670.000.000.000.000.00
615*NO DIFFERENCE0.000.000.000.000.000.00
616400Person, D0.000.001067.500.000.000.00
617400Person, D0.0073.501029.000.000.000.00
618*DIFFERENCE0.00-73.5038.500.000.000.00
619500Person, E4066.670.000.000.000.000.00
620500Person, E4066.670.000.000.000.000.00
621*NO DIFFERENCE0.000.000.000.000.000.00
62233345Person, H2358.330.000.000.000.000.00
62333345Person, H2358.330.000.000.000.000.00
624*NO DIFFERENCE0.000.000.000.000.000.00
First Sheet



Is it possible to have a macro to do this for me.. the sheet could be up to 2000 employees?
Thankyou for anyone that could assist me.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,226,693
Messages
6,192,471
Members
453,726
Latest member
JoeH57

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