Hi I am struggling to create the VBA code I need to perform a fairly complicated task.
I have an initial worksheet called 'Data_KPI4' which is in the format of below:
##See BEFORE worksheet attached##
So I need the VBA to perform the following steps:
• Iterate through the worksheet and group into separate sets of rows based on 'Episode Reference'. For example the first group for EP205143 would have 7 rows from the worksheet above.
• For each group search for the row that has 'Event Type' = 'Triage' and store the values in that row for 'Attendance Date', 'Episode Reference', 'PIN' & 'Start Date'. Ideally these will be written to a new worksheet as a new row in that worksheet.
• Also within that same group I need to create a list of dates appending all Appointment Dates in that group to the list and also append to this list all Attendance Dates in that group (which are for Event Types not equal to Triage - ie discount any Attendance Dates for Triage events). To then sort this list from oldest to newest dates and to take the earliest date in the list and add as 'First Offered Appointment Date' it to the row in the new worksheet that was populated in the previous step.
• To iterate through all groups creating new rows for every group in the new worksheet.
The final output should be a new worksheet called 'FinalData_KPI4' which looks like the following:
##See AFTER worksheet attached##
A bit of an ask but would be very grateful for any help with this as I am working in the health sector and this will help our data projections no end from the manual audit we currently have to do!
Bookmarks