Forum

vba code required t...
 
Notifications
Clear all

vba code required to manipulate data - not too sure how to describe it but included details below

3 Posts
2 Users
0 Reactions
56 Views
(@bryanrobson)
Posts: 2
New Member
Topic starter
 

Hi. First post. Hope someone can help me

The attached file is just a sample and the original has much more data but I have deleted rows out of it and also changed some of the data as it is sensitive information.

I need the code to use the start month of the billing period and the end month of the billing period by using the Start sheet and selecting the month from the drop down lists in columns E and G

For some sites there may be more than 1 row. For example, row 35 and 36 and there are others. This is because while we are at the site, we have done 2 jobs or more.

No Visits in column F is the number of visits to that site booked (not necessarily completed yet). But, if a site has more than 1 row for example row 35 and 36, then the number of visits is 3 not 3 + 3.

Then the 1 indicated in cells January to December represent when the work has been booked in and green if it has been completed. Sometimes the work may not get done as the engineer couldnt go, it was cancelled or the engineer arrived on site and couldnt do the work. So these will not be green.
The cells also have comments stating the date when the work was done.
e.g. Clean done 20/04/2022

What I need is to consolidate the data explained above. I need the same column headings on an output sheet. But, firstly, one line only for each site. The value of the number of site visits are not to be added together (just use the number in that cell). Then add up the numbers in January to December only if the cell is green and only if those months fall within the start month and end month selected in the drop down on the Start sheet. Also include the inserted comment eg Clean done 20/04/2022 in a cell.

I have included a sheet called Sample Output. So, basically if the period to be billed is June, July and August then this would be the expected results.

Thanks in advance

 
Posted : 20/08/2022 5:25 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Bryan,

It's much easier with Power Query, see the file attached.

To get the results, simply right click the PQ Output table and click Refresh, or from ribbon, Data tab>RefreshAll

However, it does not take care of colors and comments. 

The design of the data structure is not the most efficient according to the processing needs, normally a solution must be designed with the entire process in mind. Comments should be simple text in another column, instead of colors there should be a Status column with standardized options: Active, Completed, or any. Because each month needs 3 values: 1, notes and status, you decided to put all 3 in one cell using cell comments and status, but each entry should have their own record, in a properly organized data collection structure:

image_2022-08-22_074359131.png

This tabular structure can be analyzed with default excel tools, most of the times programming is required when the structure is not properly designed.

 
Posted : 23/08/2022 12:23 am
(@bryanrobson)
Posts: 2
New Member
Topic starter
 

Hi. Thanks for the reply. The file comes from another team in that format and they want to manipulate the data for billing. I will relay your comments back to the team.

 

Thanks

Darren

 
Posted : 24/08/2022 6:25 am
Share: