Finding Min and Max out of a concatenated string containing multiple values

pawan

New Member
Joined
Dec 25, 2009
Messages
44
Office Version
  1. 365
Platform
  1. Windows
I have another related problem to the Min and Max problem in a concatenated string solved in the thread below.


Here, there is no comma separation but problem is same i.e. of extracting max and min values out of a concatenated data string. The data is below.

DataExpected MinimumExpected Maximum
061031000000000000000000DDDDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD031061
XXXXXXDDDXXXXXX000000XXX
0​
0​
XXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDXXXDDDXXXDDDXXXXXXDDDXXXXXXXXXXXX
0​
0​
000000000000000000000000000000000000000000000000000054023000000000000000000000000000000000000DDDDDD000000023054


Each data point in the column "Data" is itself a concatenated string of several data points, each having a character length of 3 characters. These could be a 3 digit number or there could be "000" data point which means "no data". Similarly "DDD" or "XXX" also refer to no data being available. What is needed is a max and min of data points available.

So in the first row, 061 is the first data point, 031 is the second data point and so on. In the first row only two data points are available and 061 is maximum and 031 is minimum.

In the second and third row, there are no data points; so min and max both are Zeros "0"

In the last row 054 and 023 are the two data points and the max and min are obviously 054 and 023 respectively

There are 40K + rows in my data table and any formula using Indirect(1:xxx) which fills numbers 1 to xxx in a cell will put "hang" my file. Hence to be avoided.

Please help. Thanks in advance.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Could you have value like 540 rather than 054?
 
Upvote 0
Could you have value like 540 rather than 054?
It has to be interpreted by following the rule that three characters equals one data point. That being the overarching constraint, each data point could be upto 999 being of three digits. So the answer is yes it can be 540 but if three characters make one datapoint, the previous 51 characters are all zeros and have to be ignored making a combination of "540" non feasible. So only feasible possibility is "054" followed by "023". "540" followed by "230" is not feasible. I hope I am able to clarify.
 
Upvote 0
Ok, how about
+Fluff 1.xlsm
ABC
1DataExpected MinimumExpected Maximum
2061031000000000000000000DDDDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD061031
3XXXXXXDDDXXXXXX000000XXX00
4XXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDXXXDDDXXXDDDXXXXXXDDDXXXXXXXXXXXX00
5000000000000000000000000000000000000000000000000000054023000000000000000000000000000000000000DDDDDD000000054023
Main
Cell Formulas
RangeFormula
B2:C5B2=LET(m,MID(A2,SEQUENCE(,LEN(A2)/3,,3),3),SORT(FILTER(m,(ISNUMBER(m+1))*(m<>"000"),{"0","0"}),,-1,1))
Dynamic array formulas.
 
Upvote 0
Ok, how about
+Fluff 1.xlsm
ABC
1DataExpected MinimumExpected Maximum
2061031000000000000000000DDDDDDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD061031
3XXXXXXDDDXXXXXX000000XXX00
4XXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDXXXDDDXXXDDDXXXXXXDDDXXXXXXXXXXXX00
5000000000000000000000000000000000000000000000000000054023000000000000000000000000000000000000DDDDDD000000054023
Main
Cell Formulas
RangeFormula
B2:C5B2=LET(m,MID(A2,SEQUENCE(,LEN(A2)/3,,3),3),SORT(FILTER(m,(ISNUMBER(m+1))*(m<>"000"),{"0","0"}),,-1,1))
Dynamic array formulas.
Works for maximum. What about minimum?
 
Upvote 0
In what way? as you can see in post#4 it returns both the max & min?
Sorry. Please elaborate. It returned only the maximum value. What change do I need to make to return the minimum value?
 
Upvote 0
Please elaborate.
Look at post#4 & you can see that both values are present.
Did you use Ctrl Shift Enter to confirm the formula or just Enter?
 
Upvote 0
I did Ctrl+Shift+Enter and I got only the maximum value. I seem to be missing something.
 
Upvote 0
Don't use Ctrl Shift Enter, it should just be Enter & it will spill across
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top