![]() |
Remove Sequential Repeats
I have a single column of data containing variable length text strings. In
some of the data, characters repeat sequentially. For example AABBCCDD I need a function or formula that removes sequential repeats. if input: AABBCC output: ABC input: AAAAAA output: A input: AAABBC output: ABC input: ABCDEF output: ABCDEF input: BAAAAB output: BAB input: DD output: D Any suggestions will be greatly appreciated! -- jake |
Remove Sequential Repeats
An UDF
In a module: (Alt+F11 Insert/Module) Function SD(chaine) temp = Left(chaine, 1) For i = 2 To Len(chaine) If Right(temp, 1) < Mid(chaine, i, 1) Then temp = temp & Mid(chaine, i, 1) End If Next i SD = temp End Function http://cjoint.com/?clqkYUsXJo JB http://boisgontierjacques.free.fr On 9 fév, 15:30, Jakobshavn Isbrae wrote: I have a single column of data containing variable length text strings. *In some of the data, characters repeat sequentially. *For example *AABBCCDD I need a function or formula that removes sequential repeats. if input: *AABBCC *output: ABC input: *AAAAAA *output: A input: *AAABBC *output: ABC input: *ABCDEF *output: ABCDEF input: *BAAAAB *output: BAB input: *DD * * *output: D Any suggestions will be greatly appreciated! -- jake |
Remove Sequential Repeats
Perfect!
Thank you! -- jake "JB" wrote: An UDF In a module: (Alt+F11 Insert/Module) Function SD(chaine) temp = Left(chaine, 1) For i = 2 To Len(chaine) If Right(temp, 1) < Mid(chaine, i, 1) Then temp = temp & Mid(chaine, i, 1) End If Next i SD = temp End Function http://cjoint.com/?clqkYUsXJo JB http://boisgontierjacques.free.fr On 9 fév, 15:30, Jakobshavn Isbrae wrote: I have a single column of data containing variable length text strings. In some of the data, characters repeat sequentially. For example AABBCCDD I need a function or formula that removes sequential repeats. if input: AABBCC output: ABC input: AAAAAA output: A input: AAABBC output: ABC input: ABCDEF output: ABCDEF input: BAAAAB output: BAB input: DD output: D Any suggestions will be greatly appreciated! -- jake |
All times are GMT +1. The time now is 08:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com