Hi @SeanPress ,

You can count the quantities of each type separately in the CellValueChanged event

```
Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
Dim typeATotal = DataGridView1.Rows.Cast(Of DataGridViewRow)() _
.Where(Function(row) Not row.IsNewRow AndAlso row.Cells("Type").Value.ToString() = "A") _
.Sum(Function(row) Convert.ToInt32(row.Cells("Quantity").Value))
Dim typeBTotal = DataGridView1.Rows.Cast(Of DataGridViewRow)() _
.Where(Function(row) Not row.IsNewRow AndAlso row.Cells("Type").Value.ToString() = "B") _
.Sum(Function(row) Convert.ToInt32(row.Cells("Quantity").Value))
If DataGridView1.Rows.Count > 0 Then
DataGridView1.Rows(0).Cells("Type A Cumulative").Value = typeATotal
DataGridView1.Rows(0).Cells("Type B Cumulative").Value = typeBTotal
End If
End Sub
```

Best Regards.

Jiachen Li

If the answer is the right solution, please click "**Accept Answer**" and kindly upvote it. If you have extra questions about this answer, please click "**Comment**".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.