i have a jira-export file, and need to get it in the 1NF to be able to use the pivot function.
the data comes like this:
|----|--------|---------------|
| A | B | C |
|----|--------|---------------|
| 1 | BlaBla | C1 |
|----|--------|---------------|
| 2 | FooFoo | C1,C2,C3 |
|----|--------|---------------|
| 3 | LaLa | C3 |
|----|--------|---------------|
and i need the data in this form:
|----|--------|---------------|
| A | B | C |
|----|--------|---------------|
| 1 | BlaBla | C1 |
|----|--------|---------------|
| 2 | FooFoo | C1 |
|----|--------|---------------|
| 2 | FooFoo | C2 |
|----|--------|---------------|
| 2 | FooFoo | C3 |
|----|--------|---------------|
| 3 | LaLa | C3 |
|----|--------|---------------|
basically, the data in column C has to be looped and copy/pasted, if there are multiple entries.
any ideas?
Sub CopyData()
Dim xrow As Long
Dim cCell As Variant
Dim strArray() As String
Dim iCount As Integer
xrow = 1
Do while(Cells(xrow,"A") <> "")
cCell = Cells(xrow,"C") 'get the value in column C
strArray = Split(cCell,",") 'put the value(s) in an array (delimiter ",")
iCount = UBound(strArray) - LBound(strArray)
If iCount > 0 Then
*??????* 'copy the row
*??????* 'paste it below or at the end of the data-set with the different values in column C
*??????* 'remove the row with the ","
End If
xrow = xrow + 1
Loop
End Sub
Kind regards