#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Matching


Hi
We want to be able to match number plates using excel and creating an
output file that shows the time difference between the two number
plates. The file we get in is like this

Site Vehicle Type Reg Plate Time (Hour) Time (Min)
001 1 T890RFW 07 00
001 1 FL51FYZ 07 00
001 1 KC04PZG 07 00
001 1 P610APB 07 00
001 1 P676JKP 07 00
001 1 FG51OZB 07 00
001 1 P849GAL 07 00
001 1 R787KHP 07 00
001 1 FH52SUD 07 00
001 1 X591BAU 07 00
001 1 P258UVK 07 00
001 1 BS2200 07 01
001 1 R142GWO 07 01
002 1 FH52SUD 07 20
002 1 FG51OZB 07 29

and it needs to come out like this

Entry Place Exit Place Time Number Plate


Any help with this would be greatly appreciated. If more
clarrification is needed pls msg and i will try my best.

Skyhigh


--
Skyhigh
------------------------------------------------------------------------
Skyhigh's Profile: http://www.excelforum.com/member.php...o&userid=24907
View this thread: http://www.excelforum.com/showthread...hreadid=384449

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Matching

can we assume that the first entry is the 'entry' and the second is the 'exit'?

this should get you started:-

Option Explicit

Sub Report()

Dim ws As Worksheet
Dim source As Range
Dim rw As Long
Set source = Range("A1").CurrentRegion

Set ws = Worksheets.Add
With ws.Range("A1").Resize(source.Rows.Count, 5)
.Value = source.Value
.Sort .Range("C1"), Header:=xlYes
With .Resize(source.Rows.Count - 1, 1).Offset(1, 5)
.FormulaR1C1 = "=CountIf(C3:C3,RC3)"
End With
End With
' remove single entries
For rw = Range("A1").End(xlDown).Row To 2 Step -1
If Cells(rw, 6) = 1 Then
Rows(rw).Delete
End If
Next
' re-format
Columns(2).Insert
For rw = Range("A1").End(xlDown).Row To 3 Step -2
Cells(rw - 1, 2) = Cells(rw, 1)
Cells(rw - 1, 7) = Cells(rw, 5)
Cells(rw - 1, 8) = Cells(rw, 6)
Rows(rw).Delete
Next
End Sub
TODO: add column headers

"Skyhigh" wrote:


Hi
We want to be able to match number plates using excel and creating an
output file that shows the time difference between the two number
plates. The file we get in is like this

Site Vehicle Type Reg Plate Time (Hour) Time (Min)
001 1 T890RFW 07 00
001 1 FL51FYZ 07 00
001 1 KC04PZG 07 00
001 1 P610APB 07 00
001 1 P676JKP 07 00
001 1 FG51OZB 07 00
001 1 P849GAL 07 00
001 1 R787KHP 07 00
001 1 FH52SUD 07 00
001 1 X591BAU 07 00
001 1 P258UVK 07 00
001 1 BS2200 07 01
001 1 R142GWO 07 01
002 1 FH52SUD 07 20
002 1 FG51OZB 07 29

and it needs to come out like this

Entry Place Exit Place Time Number Plate


Any help with this would be greatly appreciated. If more
clarrification is needed pls msg and i will try my best.

Skyhigh


--
Skyhigh
------------------------------------------------------------------------
Skyhigh's Profile: http://www.excelforum.com/member.php...o&userid=24907
View this thread: http://www.excelforum.com/showthread...hreadid=384449


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Matching


Thanks we will give it a go


--
Skyhigh
------------------------------------------------------------------------
Skyhigh's Profile: http://www.excelforum.com/member.php...o&userid=24907
View this thread: http://www.excelforum.com/showthread...hreadid=384449

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
matching ids help rodchar Excel Discussion (Misc queries) 3 January 9th 09 07:06 PM
Matching AlexD Excel Discussion (Misc queries) 1 April 25th 08 03:31 PM
Matching identical data using data only once in the matching proce Robert 1 Excel Discussion (Misc queries) 1 June 29th 07 04:22 PM
Help with Matching Text Fields - Then Moving the Matching Cells Side by Side [email protected] Excel Discussion (Misc queries) 2 June 11th 07 02:38 PM
Matching data and linking it to the matching cell yvonne a via OfficeKB.com Links and Linking in Excel 0 July 13th 05 07:30 PM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"