How best to parse string lists of numbers
Data Text to Columns Delimited (space and other, use -).
Now, copy transpose. Creats bins, as such:
1 < -- in cell B3
=b3+10 < -- fill down
....so let's say you go to 50, then
in cell C3
=FREQUENCY(A3:A13,B3:B7)
Select C3:C7
Hit Ctrl + Shift + Enter.
It may take a bit of work, with the parsing strings part, but once you take
care of that, you're home free.
HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
" wrote:
Hi,
I have a data source that will be providing string values made up of
individual 1,2, or 3-digit numbers separated by spaces, ranges of
numbers indicated by a dash, or a mixture of both. There are no
repeat or overlapping values, and the numbers may range from 1 to 100.
For example, the string might look like this
"1 6-9 11 16-19 21 26-29"
The goal is to count how many of these numbers fall into one of ten
ranges of numbers, i.e. 1-10, 11-20, ... 91-100, get a lookup value
based on the range, and multiply that lookup value by the count of
numbers within the range.
My first thought was to parse the string into a single-dimension array
holding the individual numbers so I can later loop through the array
in order to get the lookup value, but would appreciate any suggestions
for making this more efficient.
Thanks very much,
Terry
|