Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88030

Excel or Google formula to count occurrences of an 8-digit number within a text string

$
0
0

I hope that you can help me.

I have a data set which includes a free text comments field; within that field there are work order numbers entered which I want to count - the WO numbers are ALWAYS 8 digits long and I thought that I had cracked it with this: =ROUNDDOWN(SUMPRODUCT(LEN(M7)-LEN(SUBSTITUTE(M7, {0,1,2,3,4,5,6,7,8,9},"")))/8,0) which correctly identifies the WO numbers in a comment like this:

NWMS - 67431710 - Mattress eta pending from contractor
NWMS - 67431797 - Double base eta pending from contractor

and returns a count of 2 (that's a single cell with multi-line comments).

Also; because of the ROUNDDOWN formula; a comment like this: CMS - 67630485 smell From waste outlets or blockage eta 05.02 only returns a count of 1 WO (which is correct)

However; the new problem I am facing is when an ETA date is added which also has 8 digits - e.g. 07/02/2020 - this incorrectly adds 1 to the WO number count.

I guess that I'm after a way of counting blocks of 8 contiguous numbers in a larger text string. This will exclude any other digits however they are entered.

I'm working in Google Sheets but I understand Excel better so a formula for either will help me as I should be able to convert it either way.

Many thanks,

Alan


Viewing all articles
Browse latest Browse all 88030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>