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
 
Sorry but there isnt I must be doing somethign else wrong i get

Microsoft visual basic for applications box

a yellow triangle with an explamtion mark in it

Then run time error '9':
subscript out of range

I can then press only OK or HELP

Ok closes dialogue box
Help takes me to a web site
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I think it is me


below are the actual titles for first 7 columns

LearnerOfficeCourse oneDate Assigned# AttemptsPass MarkDate Completed

<tbody>
</tbody>


After this it repeats


Course 2Date Assigned# AttemptsPass MarkDate Completed

<tbody>
</tbody>

<tbody>
</tbody>
The course name changes above is course 2 but it will be actual name of course

<tbody>
</tbody>

<tbody>
</tbody>

<tbody>
</tbody>

guessing trying to explain I gave vague terms for things but in actual fact you probably need facts.
 
Last edited:
Upvote 0
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 = 2 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("A1:E1").Value = Array("Student", "Course", "Attepmts", "Pass Mark", "Date Achieved")
   Sheets("Result").Range("A2").Resize(j - 1, 5).Value = Application.Transpose(Nary)
End Sub

Nary(i, j) = ary(r, c + k) is error on debug
 
Last edited:
Upvote 0
Does you're data look like this


Excel 2013 32 bit
ABCDEFGHIJKLMNOP
1StudentCourse oneDate startedno. attemptsmark acheiveddate completedCourse 2Date startedno. attemptsmark acheiveddate completedCourse threeDate startedno. attemptsmark acheiveddate completed
2bob smithfirst aid01/05/2018165%02/05/2018fire safety01/05/2018165%02/05/2018
3John Doefirst aid02/05/2018165%03/05/2018Health & safety02/05/2018165%03/05/2018
4Jane Smithfirst aid03/05/2018165%04/05/2018
5Frank Sinatrafirst aid04/05/2018165%05/05/2018Health & safety04/05/2018165%05/05/2018fire safety04/05/2018165%05/05/2018
Summary



If not can you please post some representative data. There are tools available here to help you do that & a test board here where you can try them out
 
Last edited:
Upvote 0
Does you're data look like this

Excel 2013 32 bit
ABCDEFGHIJKLMNOP
1StudentCourse oneDate startedno. attemptsmark acheiveddate completedCourse 2Date startedno. attemptsmark acheiveddate completedCourse threeDate startedno. attemptsmark acheiveddate completed
2bob smithfirst aid01/05/2018165%02/05/2018fire safety01/05/2018165%02/05/2018
3John Doefirst aid02/05/2018165%03/05/2018Health & safety02/05/2018165%03/05/2018
4Jane Smithfirst aid03/05/2018165%04/05/2018
5Frank Sinatrafirst aid04/05/2018165%05/05/2018Health & safety04/05/2018165%05/05/2018fire safety04/05/2018165%05/05/2018

<tbody>
</tbody>
Summary




If not can you please post some representative data. There are tools available here to help you do that & a test board here where you can try them out

Almost exactly But empty cells have a - in them if that makes sense.. In simple terms it is a report but we need to be able to pull data from the report more easily to report on it.

Instead of course one course two etc it is teh exact name of the course

The no of attempts is #Attempts



Thanks
 
Last edited:
Upvote 0
Ok, add this line of code as shown
Code:
   ary = Sheets("Data").Range("A1").CurrentRegion.Offset(1)
  [COLOR=#0000ff] MsgBox UBound(ary, 1) & vbLf & UBound(ary, 2)[/COLOR]
   j = 1
What does the message box say?.
And when the macro crashes what are the values of i,j,r,c &k?
 
Upvote 0
Added line as shown

Run-time error'9':
subscript out of range

I hit debug and it just highlights Nary(i, j) = ary(r, c + k) in yellow

I dont see where I get you the values

Got it
39
227

I get a box pop up on the data spread sheet

Just says Microsoft excel as title

and has
39
227
 
Last edited:
Upvote 0
I am running this on a sample of data to get it working dont know if that matters but there are only 39 rows just thought I would say

We will have multiple exports that has different amounts of rows and columns in them

sorry if I confuse things at all just trying to tell you everything.

Some exports will be much bigger
 
Upvote 0
Would you be willing to upload your test file to a share site such as OneDrive, DropBox, Google, mark for sharing & post the link to this thread?
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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