Individual incident data

cce

New Member
Joined
Oct 18, 2012
Messages
9
I have a spreadsheet that has numerous entries by individual. The sheet logs all accidents that have taken place on site and I want to be able to provide a summary by individual. I have tried pivot tables but that just shows how many times each individual has an entry. Ideally I would like to show the last 3 incidents by individual and then the brief description of what happened. So I think I need to show the name, date and then text. Is this possible?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
This could be done using vba.
But you have provided no specific details.

You said:
I have a spreadsheet. But did not give the sheet name.

You said:

The sheet logs all accidents that have taken place on site

But did not specify where exact detail is entered.

You need to say Name is in column A date of incident is in column B
Type incident in column C
Comments in column D

And more if needed.

Then where do you want this summary entered.

We always need specific details
<strike>
</strike>
 
Upvote 0
Thank you for replying. I was trying to find someway of attaching the spreadsheet or a screen shot but had no luck.

Anyway, sorry for not explaining it further. In column A there is the date, column B is who the operator was. Column C is the type of incident i.e. property damage, first aid injury etc. and colum D is a brief description, i.e. dropped pallet, hit head on trailer etc. There are over 250 entries for the last 5 years, so i want to build a 1 pager of different information for an individual. If you can show me how to do a vba that would be great.

Thanks

This could be done using vba.
But you have provided no specific details.

You said:
I have a spreadsheet. But did not give the sheet name.

You said:

The sheet logs all accidents that have taken place on site

But did not specify where exact detail is entered.

You need to say Name is in column A date of incident is in column B
Type incident in column C
Comments in column D

And more if needed.

Then where do you want this summary entered.

We always need specific details
<strike>
</strike>
 
Upvote 0
So how about something like this to begin with.

I will write a script where:

Lets assume your sheet name is Incidents.
Fist a Input box pops up and ask what name you want to search for.

You enter George Jones

The script will look down column B of sheet named Incidents for George Jones

Ever time it finds George Jones that entire row of data will be copied to sheet named Results

So now on sheet named Results you will have a list of all incidents caused by George Jones.

Would something like that work?

Later if you wanted we could ask the script to search for all incidents caused by George Jones in the last 90 days.

Or do you have some other suggestion.
 
Upvote 0
I was trying to find someway of attaching the spreadsheet or a screen shot but had no luck.
See the Look here link in my signature block below for ways to post small sample data that can be copied to test with, directly in your forum post.
 
Upvote 0
That sounds perfect in principal, but I have no idea how to go about it! Can it show incidents for the last 365 days?
 
Upvote 0
Do you mean all incidents for the last 365 days.
Or all Incidents caused by George for last 365 days.

You would enter name in Inputbox
 
Upvote 0
One the name is input the search will show their incidents only for last 365 days
 
Upvote 0
Try this.
Now make sure you run this script from a sheet With all your data.
And make sure you have a sheet name Results
The results will be copied to a sheet named Results
And be sure the name entered is exactly what is in column B

Code:
Sub Filter_Me_Please()
'Modified  10/2/2018  9:54:15 AM  EDT
Application.ScreenUpdating = False
Dim lastrow As Long
Dim c As Long
Dim ans As String
ans = InputBox("Enter Search Name")
c = 1 ' Column Number Modify this to your need
lastrow = Cells(Rows.Count, c).End(xlUp).Row
With ActiveSheet.Cells(1, c).Resize(lastrow, 4)
    .AutoFilter Field:=1, Criteria1:=">" & CDbl(Date - 365)
    .AutoFilter Field:=2, Criteria1:=ans
    
    counter = .Columns(c).SpecialCells(xlCellTypeVisible).Count
    If counter > 1 Then
        .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("Results").Rows(2)
    Else
        MsgBox "No values found"
    End If
    .AutoFilter
End With
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Another comment:
In case you have two employees with the same name.
You may want to consider putting a employee company id # in column B.
This would then make sure the correct employee is selected.
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,354
Members
449,155
Latest member
ravioli44

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