Hello everyone.
I worked on a set of data, and I made specific sums with it.
The data is composed of a first column containing the name of the object, second containing the quantity of items for every object and a third column containing a batch number.
Now I have the sums in a column next to the data.
If there are 20 lines of data, there will be 20 lines of results, the sums.
The thing is that as I did sums of the quantity of objects by batch, I made groups of objects and added their quantities, my code to display the sums repeats the sums.
For exemple if i have :
5
7
3
5
6
and i'm adding the first 3 columns and the last 2, separately, the sums colums will be like that :
15
15
15
11
11
There are duplicates.
So I wrote this line in VBA in order to remove duplicates :
But I was wondering that if by any chance I had the same sum value for batch 1 and batch 2, this code would take the value of batch 2 as a duplicate and remove it.Please Login or Register to view this content.
So I'm asking : is there a way to remove duplicates only when the values of the cells in the adjacent column, the batch number column, are all the same ?
It will only remove the duplicates for the lines where the batch number is 1, then consider separately the lines where the batch number is 2 and remove the duplicates there and so on.
This way it won't remove the value of the sum of batch 2 even if it the same as that of batch 1, because the batch number will have changed.
Here is an Excel sample.
Thank you very much.
Bookmarks