How can I add duplicate rows of data based on info in a specific cell in excel?

Maggie C 0 Reputation points
2023-08-31T23:46:43.73+00:00

I am trying to create duplicate records in excel based on the data in a specific column. The data has one unique identifier per record but multiple models can apply to the identifier. I want to copy and duplicate the record if there are multiple models noted and show only one model in the new reference noted. I added a screenshot of an example of the data and the output I'd like to see. The actual data set is much larger and I'd ideally like to see the ouput on a separate tab. I believe this may be accomplished through VBA though I am not sure the code to do so.

User's image

Microsoft 365 and Office | Excel | For business | Windows
{count} votes

4 answers

Sort by: Most helpful
  1. Herbert Seidenberg 1,201 Reputation points
    2023-09-05T01:18:22.4+00:00

    Excel 365 Pro Plus with Power Query.
    Duplicate record if adjacent cell has multiple values.
    No formulas, no VBA macro.
    https://www.mediafire.com/file_premium/xmqe7738isljwct/09_04_23.xlsx/file
    https://www.mediafire.com/file_premium/5bfm6tjbud9ekk4/09_04_23.pdf/file

    0 comments No comments

  2. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-07-30T23:08:04.7266667+00:00

    Hi,

    Load the data to Power Query and right click on the second column. Select Split Data > By delimiter. Specify the delimiter as , and expand Options. Select Rows > OK. Click on Close and Apply.

    Hope this helps.

    0 comments No comments

  3. peiye zhu 320 Reputation points
    2025-08-02T03:01:55.8133333+00:00
    0 comments No comments

  4. peiye zhu 320 Reputation points
    2025-08-02T03:10:04.8333333+00:00
    arr = [a2].CurrentRegion
    ReDim brr(1 To 10000, 1 To UBound(arr, 2))
    For i = 3 To UBound(arr)
        If arr(i, 2) <> "" Then
              skjs = Split(arr(i, 2), ",")
              For j = 0 To UBound(skjs)
                  n = n + 1
                  For k = 1 To UBound(arr, 2)
                       If k <> 2 Then
                          brr(n, k) = arr(i, k)
                        Else
                          brr(n, k) = skjs(j)
                        End If
                  Next
                Next
         End If
    Next
    [H3].Resize(n, UBound(brr, 2)) = brr
    
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.