![]() |
Number of Occurrences of a String Value within a String
I am analysing some string data mostly for numeric values, but want to
remove those values that look like dates (e.g. 12/12/2008). Part of the analysis means that I must count the number of occurrences on the value "/" within the string. Does anyone know of a function that would give me the count of the number of instances of "/" or any other string portion? |
Number of Occurrences of a String Value within a String
Try
=LEN(A1)-LEN(SUBSTITUTE(A1,"/","")) Mike "Stephen Allen" wrote: I am analysing some string data mostly for numeric values, but want to remove those values that look like dates (e.g. 12/12/2008). Part of the analysis means that I must count the number of occurrences on the value "/" within the string. Does anyone know of a function that would give me the count of the number of instances of "/" or any other string portion? |
Number of Occurrences of a String Value within a String
With the text value in A1, use:
=LEN(A1)-LEN(SUBSTITUTE(A1,"/","")) this will give the count of slashes in the cell. NOTE the data must be text and not a Date nor formulaic divide -- Gary''s Student - gsnu200816 "Stephen Allen" wrote: I am analysing some string data mostly for numeric values, but want to remove those values that look like dates (e.g. 12/12/2008). Part of the analysis means that I must count the number of occurrences on the value "/" within the string. Does anyone know of a function that would give me the count of the number of instances of "/" or any other string portion? |
Number of Occurrences of a String Value within a String
=(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))/LEN("/")
Obviously the division by LEN("/") is unnecessary if the string portion you are looking for is a single character, but it allows for the more general case if you were looking for a longer string portion. -- David Biddulph "Stephen Allen" wrote in message ... I am analysing some string data mostly for numeric values, but want to remove those values that look like dates (e.g. 12/12/2008). Part of the analysis means that I must count the number of occurrences on the value "/" within the string. Does anyone know of a function that would give me the count of the number of instances of "/" or any other string portion? |
Number of Occurrences of a String Value within a String
Thank you all. It works a treat.
On Nov 26, 1:30*pm, Stephen Allen wrote: |
All times are GMT +1. The time now is 01:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com