ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   parsing data (https://www.excelbanter.com/excel-programming/403152-parsing-data.html)

leovh

parsing data
 
I import team performance data. The teams may have 12 players but jersey
numbers may run from 1 to 20. The numbers are not sorted..

In a simplified way I receive data as under B and would like to have them
parsed as under C There will be at least 6 matches and four teams at
different sheets.Could this be done with a scrpt.

A B C

1 1 1

2 4 -

3 3 3

4 4

etc

20

1 1 1



Dave D-C[_3_]

parsing data
 
This may be a start:

Sub zParse()
Dim iRowA&, iRowZ&, iRowV&, s1$, zCell As Range
With ActiveSheet
iRowA = 2
iRowZ = .UsedRange.SpecialCells(xlCellTypeLastCell).Row
Range(Cells(2, 3), Cells(iRowZ, 3)) = "'-"
For iRowV = 2 To iRowZ
s1 = .Cells(iRowV, 2)
Set zCell = .Columns(1).Find(s1, , xlValues, xlWhole)
If Not zCell Is Nothing Then
.Cells(zCell.Row, 3) = s1
End If
Next iRowV
End With
End Sub ' Dave D-C

.. four teams at different sheets ..

If this works, you could do it for other sheets.

"leovh" wrote:
I import team performance data. The teams may have 12 players but jersey
numbers may run from 1 to 20. The numbers are not sorted..

In a simplified way I receive data as under B and would like to have them
parsed as under C There will be at least 6 matches and four teams at
different sheets.Could this be done with a scrpt.

A B C
1 1 1
2 4 -
3 3 3
4 4
etc
20

what's this?
1 1 1


Dave D-C[_3_]

parsing data
 
Probably better is a sheet solution:
in C2, put
=IF(ISNA(MATCH(A2,B:B,FALSE)),"-",A2)
and copy down.

Dave D-C wrote:
This may be a start:
Sub zParse()

[deleted]

"leovh" wrote:
I import team performance data. The teams may have 12 players but jersey
numbers may run from 1 to 20. The numbers are not sorted..

In a simplified way I receive data as under B and would like to have them
parsed as under C There will be at least 6 matches and four teams at
different sheets.Could this be done with a scrpt.

A B C
1 1 1
2 4 -
3 3 3
4 4
etc
20

what's this?
1 1 1



leovh

parsing data
 
Thank you Dave for help, the sheet looks as more intersting solution. The
cells to rthe right however are taken by the player performance data.
Manually therfore I insert or delete blank rows to solve the problemm.



"Dave D-C" a écrit dans le message de news:
...
Probably better is a sheet solution:
in C2, put
=IF(ISNA(MATCH(A2,B:B,FALSE)),"-",A2)
and copy down.

Dave D-C wrote:
This may be a start:
Sub zParse()

[deleted]

"leovh" wrote:
I import team performance data. The teams may have 12 players but jersey
numbers may run from 1 to 20. The numbers are not sorted..

In a simplified way I receive data as under B and would like to have
them
parsed as under C There will be at least 6 matches and four teams at
different sheets.Could this be done with a scrpt.

A B C
1 1 1
2 4 -
3 3 3
4 4
etc
20

what's this?
1 1 1






All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com