Hi everyone,
For the last week I have been trawling through many different posts and Excel resource websites trying to find a solution. Unfortunately I have to ask your help. I'm familiar with VBA and Macros, but not indepth or professional enough to knowing all the ins and outs of VBA, or its coding/language/terms.
I have a fortnightly payroll report from an antiquated system which puts the data in such a way I can't use it with my other HR information. I need to sort the data. Below you can see examples of what I have and what I want.
Attempt to Offset or Transpose
I tried looking at finding data and then offsetting it. However, due to the fact that not all have the same totals (for example some don't have the row "6 accrued day off") offsetting doesn't work. Unless I can build in multiple conditions, or offeset it against the name. Not sure how to do that.
If only the employee ID number wouldn't be in front of the names, then I could sort it by the numbers. But that doesn't work as some employees have the same number as ID (example "6 Croft Lara") However, luckily the name fields are unique as they have commas in them, so maybe some type of *,* condition may do the trick.
The first occurance of the name could be set as the start of the range, the second occurance of the same name as the end of the range. What is inbetween would then need to be sorted (offset/transposed) next to the first occurance of the name.
(Not in the example below) Next I would need to clean up the unused collumns, try to split the employee ID from the name and I would have an Excel sheet I can use.
How to create a Macro which can do all of the above? Your help/advise is much appreciated.
Kris
Before (what I have)
<tbody>
</tbody>
After (what I want)
<tbody>
</tbody>
For the last week I have been trawling through many different posts and Excel resource websites trying to find a solution. Unfortunately I have to ask your help. I'm familiar with VBA and Macros, but not indepth or professional enough to knowing all the ins and outs of VBA, or its coding/language/terms.
I have a fortnightly payroll report from an antiquated system which puts the data in such a way I can't use it with my other HR information. I need to sort the data. Below you can see examples of what I have and what I want.
Attempt to Offset or Transpose
I tried looking at finding data and then offsetting it. However, due to the fact that not all have the same totals (for example some don't have the row "6 accrued day off") offsetting doesn't work. Unless I can build in multiple conditions, or offeset it against the name. Not sure how to do that.
If only the employee ID number wouldn't be in front of the names, then I could sort it by the numbers. But that doesn't work as some employees have the same number as ID (example "6 Croft Lara") However, luckily the name fields are unique as they have commas in them, so maybe some type of *,* condition may do the trick.
The first occurance of the name could be set as the start of the range, the second occurance of the same name as the end of the range. What is inbetween would then need to be sorted (offset/transposed) next to the first occurance of the name.
(Not in the example below) Next I would need to clean up the unused collumns, try to split the employee ID from the name and I would have an Excel sheet I can use.
How to create a Macro which can do all of the above? Your help/advise is much appreciated.
Kris
Before (what I have)
Page 1 | |||||||||||
Employee Leave Report for the Ranges Organisation Unit ID range 15 to 15 as at 31/03/2013 | |||||||||||
Organistaional Unit | Employee | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | |||
Balance | This Year | This Year | Credits | Credits | Liability | ||||||
15 D Services | |||||||||||
1143 Smith1, John1 | |||||||||||
3 sick leave with certificate | 0.69 | 0.00 | 0.00 | 0.69 | 0.00 | 0.69 | 12.41 | ||||
4 sick without certificate | 0.35 | 0.00 | 0.00 | 0.35 | 0.00 | 0.35 | 6.21 | ||||
5 long service leave | 0.45 | 0.00 | 0.00 | 0.45 | 0.00 | 0.45 | 8.07 | ||||
1143 Smith1, John1 | 1.49 | 0.00 | 0.00 | 1.49 | 0.00 | 1.49 | 26.69 | ||||
409 Smith2, John2 | |||||||||||
2 annual leave | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | -0.02 | ||||
5 long service leave | 183.13 | 0.00 | 0.00 | 183.13 | 0.00 | 183.13 | 4,594.45 | ||||
409 Smith2, John2 | 183.13 | 0.00 | 0.00 | 183.13 | 0.00 | 183.13 | 4,594.43 | ||||
940 Smith3, John3 | |||||||||||
2 annual leave | 99.77 | 57.06 | 156.83 | 0.00 | 0.00 | 0.00 | -0.02 | ||||
3 sick leave with certificate | 124.84 | 0.00 | 95.00 | 29.84 | 0.00 | 29.84 | 708.87 | ||||
4 sick without certificate | 6.00 | 0.00 | 7.00 | -1.00 | 0.00 | -1.00 | -23.75 | ||||
5 long service leave | 84.13 | 12.36 | 0.00 | 96.49 | 0.00 | 96.49 | 2,291.81 | ||||
15 leave loading | 60.85 | 38.04 | 98.88 | 0.00 | 0.00 | 0.00 | 0.00 | ||||
940 Smith3, John3 | 375.58 | 107.46 | 357.71 | 125.33 | 0.00 | 125.33 | 2,976.91 | ||||
560 Smith4, John4 | |||||||||||
2 annual leave | 104.08 | 174.46 | 211.00 | 67.54 | 0.00 | 67.54 | 1,786.62 | ||||
3 sick leave with certificate | 271.54 | 92.00 | 0.00 | 363.54 | 0.00 | 363.54 | 9,616.01 | ||||
4 sick without certificate | 16.00 | 22.00 | 7.00 | 31.00 | 0.00 | 31.00 | 819.99 | ||||
5 long service leave | 369.40 | 37.80 | 0.00 | 407.20 | 0.00 | 407.20 | 10,771.09 | ||||
15 leave loading | 72.34 | 116.31 | 135.00 | 53.65 | 0.00 | 53.65 | 248.36 | ||||
560 Smith4, John4 | 833.37 | 442.57 | 353.00 | 922.94 | 0.00 | 922.94 | 23,242.07 | ||||
1201 Croft1, Lara1 | |||||||||||
2 annual leave | 0.00 | 70.21 | 0.00 | 70.21 | 0.00 | 70.21 | 1,468.58 | ||||
3 sick leave with certificate | 0.00 | 23.40 | 0.00 | 23.40 | 0.00 | 23.40 | 489.53 | ||||
4 sick without certificate | 0.00 | 11.70 | 0.00 | 11.70 | 0.00 | 11.70 | 244.76 | ||||
5 long service leave | 0.00 | 15.21 | 0.00 | 15.21 | 0.00 | 15.21 | 318.19 | ||||
7 time in lieu | 0.00 | 8.00 | 7.00 | 1.00 | 0.00 | 1.00 | 20.92 | ||||
15 leave loading | 0.00 | 46.81 | 0.00 | 46.81 | 0.00 | 46.81 | 171.33 | ||||
1201 Croft1, Lara1 | 0.00 | 175.34 | 7.00 | 168.34 | 0.00 | 168.34 | 2,713.31 | ||||
6 Croft2, Lara2 | |||||||||||
2 annual leave | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | -0.08 | ||||
3 sick leave with certificate | 609.50 | 0.00 | 0.00 | 609.50 | 0.00 | 609.50 | 11,971.80 | ||||
4 sick without certificate | 16.00 | 0.00 | 0.00 | 16.00 | 0.00 | 16.00 | 314.27 | ||||
5 long service leave | 433.83 | 0.00 | 0.00 | 433.83 | 0.00 | 433.83 | 8,521.30 | ||||
6 accrued day off | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.02 | ||||
15 leave loading | 52.63 | 0.00 | 0.00 | 52.63 | 0.00 | 52.63 | 180.90 | ||||
6 Croft2, Lara2 | 1,111.95 | 0.00 | 0.00 | 1,111.95 | 0.00 | 1,111.95 | 20,988.21 |
<tbody>
</tbody>
After (what I want)
Page 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Employee Leave Report for the Ranges Organisation Unit ID range 15 to 15 as at 31/03/2013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
2 annual leave | 3 sick leave with certificate | 4 sick without certificate | 5 long service leave | 6 accrued day off | 7 time in lieu | 15 leave loading | |||||||||||||||||||||||||||||||||||||||||||||||
Organistaional Unit | Employee | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | Opening | Accrued | Taken | Hrs Leave | Adjustment | Total Leave | Total $ | |||
Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | Balance | This Year | This Year | Credits | Credits | Liability | ||||||||||||
1143 Smith1, John1 | 0.69 | 0.00 | 0.00 | 0.69 | 0.00 | 0.69 | 12.41 | 0.35 | 0.00 | 0.00 | 0.35 | 0.00 | 0.35 | 6.21 | 0.45 | 0.00 | 0.00 | 0.45 | 0.00 | 0.45 | 8.07 | ||||||||||||||||||||||||||||||||
409 Smith2, John2 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | -0.02 | 183.13 | 0.00 | 0.00 | 183.13 | 0.00 | 183.13 | 4,594.45 | |||||||||||||||||||||||||||||||||||||||
940 Smith3, John3 | 99.77 | 57.06 | 156.83 | 0.00 | 0.00 | 0.00 | -0.02 | 124.84 | 0.00 | 95.00 | 29.84 | 0.00 | 29.84 | 708.87 | 6.00 | 0.00 | 7.00 | -1.00 | 0.00 | -1.00 | -23.75 | 84.13 | 12.36 | 0.00 | 96.49 | 0.00 | 96.49 | 2,291.81 | 60.85 | 38.04 | 98.88 | 0.00 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||
560 Smith4, John4 | 104.08 | 174.46 | 211.00 | 67.54 | 0.00 | 67.54 | 1,786.62 | 271.54 | 92.00 | 0.00 | 363.54 | 0.00 | 363.54 | 9,616.01 | 16.00 | 22.00 | 7.00 | 31.00 | 0.00 | 31.00 | 819.99 | 369.40 | 37.80 | 0.00 | 407.20 | 0.00 | 407.20 | 10,771.09 | 72.34 | 116.31 | 135.00 | 53.65 | 0.00 | 53.65 | 248.36 | ||||||||||||||||||
1201 Croft1, Lara1 | 0.00 | 70.21 | 0.00 | 70.21 | 0.00 | 70.21 | 1,468.58 | 0.00 | 23.40 | 0.00 | 23.40 | 0.00 | 23.40 | 489.53 | 0.00 | 11.70 | 0.00 | 11.70 | 0.00 | 11.70 | 244.76 | 0.00 | 15.21 | 0.00 | 15.21 | 0.00 | 15.21 | 318.19 | 0.00 | 8.00 | 7.00 | 1.00 | 0.00 | 1.00 | 20.92 | 0.00 | 46.81 | 0.00 | 46.81 | 0.00 | 46.81 | 171.33 | |||||||||||
6 Croft2, Lara2 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | -0.08 | 609.50 | 0.00 | 0.00 | 609.50 | 0.00 | 609.50 | 11,971.80 | 16.00 | 0.00 | 0.00 | 16.00 | 0.00 | 16.00 | 314.27 | 433.83 | 0.00 | 0.00 | 433.83 | 0.00 | 433.83 | 8,521.30 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.02 | 52.63 | 0.00 | 0.00 | 52.63 | 0.00 | 52.63 | 180.90 |
<tbody>
</tbody>