Hello,

I’m completely new to Excel macros and I’m hoping someone here might be kind enough to help me create a slightly fiddly one.

I have a worksheet with several thousands of rows and many of these are essentially duplicates I want to get rid of. Basically, one column contains a string (just text) and within this string may or may not be the word “Fixed”. I need to see if that string contains “Fixed” (and I don’t even know if looking inside a string is possible) and if it does, I need to compare it with the same cell in the row below. If that cell also contains “Fixed”, I want to delete that second entire row. I then want to repeat the test. In other words, I want to keep the first row that has “Fixed” in the target cell but delete its duplicates.

There’s a catch, natch. Once I’ve deleted all the duplicates of the first instance of "Fixed" (i.e. I come to a row that doesn’t match the row above when the strings are compared), I want to continue searching until I find another instance of the string. I then want to keep that instance but delete all its duplicates.

I think the logic goes like this:

1. Look in column C, row n (starting at row one)
2. If column C is empty, stop
3. Does cell contain the (sub)string “Fixed”?
4. If cell doesn’t contain “Fixed”, move to row n+1 and repeat steps 2 onwards
5. If cell does contain “Fixed”, repeat test on same cell in row below
If this cell also contains “Fixed”
Delete this entire row and move all remaining rows up (so no blank rows are created)
If it doesn’t, repeat step 4 and continue

This really isn't my forte and my investigations into macros have so far only hinted at parts of the solution. If your Kung Fu makes this task look trivially easy, I would be very grateful indeed for any assistance you can give me.

Thank you for reading.

A Knownowt