This should solve your problem. I set up a workbook with 2 tabs: RawData and PNTotals. I created data that resembles the two rows in your example. I have 26 rows with 3 different PN#s: Honda, Toyota, and Kia. The code works regardless of how many rows and PN#s you have.
After running the code below, I end up with totals by PN on the PNTotals tab that look like this:
HONDA CAR - BLACK 4 WHEELS 936 516 2214
TOYOTA CAR 864 414 2079
KIA CAR - RED SPORT PACKAGE 504 204 1234
To get this to work, add the following code to a module and run the sub DispatchTotalsByPNNumber().
Option Explicit
Sub DispatchTotalsByPNNumber()
Dim LastPN As Long
LastPN = Sheets("RawData").Range("A1").End(xlDown).Row
GetDistinctListOfPNNumbers (LastPN)
GetQuantityTotalsForEachPNNumber (LastPN)
End Sub
Sub GetDistinctListOfPNNumbers(ByVal LastPN As Long)
Sheets("PNTotals").Cells.Clear
Sheets("RawData").Range("A2:A" & LastPN).Copy Sheets("PNTotals").Range("A1")
Sheets("PNTotals").Range("a:a").RemoveDuplicates Columns:=1, Header:=xlNo
End Sub
Function DescCols(ByVal LastPN As Long) As Integer
Dim i As Integer
For i = 2 To 10 ' If you ever have more than 9 description columns, increase range here
If Not IsNumeric(Cells(Cells(LastPN + 1, i).End(xlUp).Row, i)) Then
DescCols = DescCols + 1
Else
Exit Function
End If
Next i
End Function
Sub GetQuantityTotalsForEachPNNumber(ByVal LastPN As Long)
Dim i As Long
Dim x As Integer
Dim TotCols As Integer
Dim PNN As String
Dim ThisColumn As String
Dim PNCount As Integer
TotCols = Sheets("RawData").Range("A1").End(xlToRight).Column
PNCount = 1
' get count of PN#s if there are more than 1
If Sheets("PNTotals").Range("A2").Value <> "" Then
PNCount = Sheets("PNTotals").Range("a1").End(xlDown).Row
End If
For i = 1 To PNCount
PNN = Sheets("PNTotals").Range("A" & i).Value
Sheets("RawData").Select
Sheets("RawData").Range("A1").Select
Sheets("RawData").Cells.Find(What:=PNN, after:=ActiveCell, searchorder:=xlByRows).Activate
' Copy description text from first instance of pn to total sheet for all description columns
For x = 1 To DescCols(LastPN)
Sheets("PNTotals").Cells(i, x + 1).Value = ActiveCell.Offset(, x).Value
Next
For x = x + 1 To TotCols
ThisColumn = GetColumnLetter(x)
' set sumif formulas for however many quantity columns we have
Sheets("PNTotals").Range(ThisColumn & i).Formula = "=SUMIF(RawData!A2:" & ThisColumn & LastPN & ",PNTotals!A" & i & ",RawData!" & ThisColumn & "2:" & ThisColumn & LastPN & ")"
Next
Next
End Sub
Function GetColumnLetter(ByVal ColNum As Integer) As String
GetColumnLetter = Left(ActiveSheet.Cells(1, ColNum).Address(False, False), (ColNum <= 26) + 2)
End Function
NOTES: Assumes raw data starts in cell A1 of the RawData sheet and that there aren't any blank PN#s. If there are blanks, you'll need to determine the last PN row differently.