I have a large list of text strings. I know that some strings occur more than once in this list. The frequency with which the strings occur are in the next column.
Now, let’s say the text string “hello” occurs 17 times. How would I get all positions of this text within the list?
Any help is appreciated.
Asuming that all your strings are in one column, you can add a second column with their position (line number) and do a pivot table across the strings displaying the counts.
In order to get the position(s) of a string you are interested in, you use the pivot table’s drill-down function (double click on the count next to a string) which will create a new sheet with all detail records – and the position will be displayed
Hope that helps
Good lock
EDIT after comments exchanged:
I would go for a solution that scans your data only 1 time and not recursively, copying values to a second sheet:
so far the metacode …. do you need more help to actually code this in VBA?
EDIT 2
OK …. made a quick & dirty one ….
tested with 500 words from “Lorem ipsum” – takes below 1 second, output in sheet_2 looks like
Hope that helps