i have bunch of random data sets of 1, 2 and 3s in a column. e.g. 1 1 1 2 3 1 3 3 3 3 3 2 1
i want to do an if statement if there are consecutive 2 or 3 e.g. 22 or 333, i want to change them to 1.
i tried to approach the question with an if statement of if cell (i,1) = (i+1,1) then using a for loop as the data set is huge
but the problem in that code is that it does not deal with odd numbers of consecutive, if i use that code and change a 3 consecutive, it will leave the third data unchanged where i want to change it to 1 instead.
does anyone know how to approach this? Im doing this in excel VBA by the way
Aucun commentaire:
Enregistrer un commentaire