Compiling data from a training report

magpie2000k

Board Regular
Joined
Sep 13, 2013
Messages
196
Hi I wonder if you can help me I have a spread sheet of training for my staff

Student
Course one
Date started
no. attempts
mark acheived
date completed
Course 2
Date started
no. attempts
mark acheived
date completed

<tbody>
</tbody>
Course three
Date started
no. attempts
mark acheived
date completed

<tbody>
</tbody>
bob smith
first aid
01/05/2018
1
65%
02/05/2018
fire safety

<tbody>
</tbody>

The columns go on and on for multiple courses
I basically need to pull a summary for the learner

However as the columns go across the page they may or may not have taken each course

so in example above bob may have taken course on but not course 2 or three but may have taken course 4 (not shown)

What I am hoping to acheive isthe following

Delegate
Course
Attempts
Pass mark
Date achieved
Bob Smith
First aid
1
65%
02/05/2018
Bob Smith
Fire
Bob Smith
Course 3
Bob Smith
Course 4
2
75%
03/05/2018

<tbody>
</tbody>

I hope that makes some rough sense. I am more looking at the general way of doing it then I should be able to adapt the formulas.

Thanks
 
The board policy is that everything is to be kept on the board & so files cannot be shared privately.
If you are unwilling to share the file publicly, we'll just have to try & debug it long distance.
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Ok, You've got an extra column in there that's causing the problem.
If you don't want to keep the Office try
Code:
Sub ReorganiseData()
   Dim r As Long, c As Long, i As Long, j As Long, k As Long
   Dim ary As Variant
   Dim Nary() As Variant
   
   ary = Sheets("data").Range("A1").CurrentRegion.Offset(1)
   j = 1
   For r = 1 To UBound(ary)
      For c = 3 To UBound(ary, 2) Step 5
         If Not ary(r, c) = "-" Then
            ReDim Preserve Nary(1 To 5, 1 To j)
            Nary(1, j) = ary(r, 1)
            For i = 2 To 5
               Nary(i, j) = ary(r, c + k)
               If k = 0 Then k = 2 Else k = k + 1
            Next i
            j = j + 1: k = 0
         End If
      Next c
   Next r
   Sheets("Result").Range("A7:E7").Value = Array("Student", "Course", "Attepmts", "Pass Mark", "Date Achieved")
   Sheets("Result").Range("A8").Resize(j - 1, 5).Value = Application.Transpose(Nary)
End Sub
If you want the office let me know. Also if "date Assigned" is "Blank" do you want that course excluded from the result?
 
Upvote 0
if date assigned is blank then yes exclude means they havent had teh course to complete

Yes please keep office if not too much trouble as there can be multiple entries in that

would like office in the results...

hope that makes sense

In results can we add date asigned column
 
Last edited:
Upvote 0
How about
Code:
Sub ReorganiseData()
   Dim r As Long, c As Long, i As Long, j As Long, k As Long
   Dim ary As Variant
   Dim Nary() As Variant
   
   ary = Sheets("data").Range("A1").CurrentRegion.Offset(1)
   j = 1
   For r = 1 To UBound(ary)
      For c = 3 To UBound(ary, 2) Step 5
         If Not ary(r, c + 1) = "-" Then
            ReDim Preserve Nary(1 To 7, 1 To j)
            Nary(1, j) = ary(r, 1)
            Nary(2, j) = ary(r, 2)
            For i = 3 To 7
               Nary(i, j) = ary(r, c + k)
               k = k + 1
            Next i
            j = j + 1: k = 0
         End If
      Next c
   Next r
   Sheets("Result").Range("A1:G1").Value = Array("Student", "Office", "Course", "Date Assigned", "Attepmts", "Pass Mark", "Date Achieved")
   Sheets("Result").Range("A2").Resize(j - 1, 7).Value = Application.Transpose(Nary)
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Just so I know can a macro look at two spear sheets at same time.
Believe it or not the system to pull the reports from allows you to pull a user form also ie

Name office email address telephone number user name and password.

Would it be possible for the code to add those fields into the report you just created if they were indeed in a seperate tabe on the same workbook
 
Upvote 0
Yes that should be possible.
 
Upvote 0
great if I need it should i pop you a message or just update this thread. just to help you remember where you got to.. Might not need it but may do


Thanks again for everything
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,447
Members
448,898
Latest member
drewmorgan128

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