Aug 07 2021 02:16 AM
Hello,
I created a macro which allows to compare the identifiers of two cells:
- if the identifiers are equal, it makes the sum of flow
- if not, the flow remains constant
For ligne = 3 To 9214
If Cells(ligne, 2) = Cells(ligne + 1, 2) Then
Cells(ligne, 7).Value = Cells(ligne, 2)
Cells(ligne, 8).Value = Cells(ligne, 3) + Cells(ligne + 1, 3)
Else
Cells(ligne, 7).Value = Cells(ligne, 2)
Cells(ligne, 8).Value = Cells(ligne, 3)
End If
Next ligne
In the first case, how I can calculate the sum for a repeated identifier by removing any occurrence of this identifier.
For example in this file, I do not want to take into account line 7 in the new table.
Thank you in advance.
Aug 07 2021 03:01 AM
Solution@Belsam_mzh It looks like you are trying to write VBA code for something that is easily done with a pivot table. But I may be mistaken.
Anyway, have a look at the pivot table I created. It seems to do what you want.
Aug 07 2021 03:01 AM
Solution@Belsam_mzh It looks like you are trying to write VBA code for something that is easily done with a pivot table. But I may be mistaken.
Anyway, have a look at the pivot table I created. It seems to do what you want.