Min and Max on comma separated values in a cell

moishier

New Member
Joined
Mar 27, 2016
Messages
4
I have cells that contain comma separated number values. I need to extract the MIN and MAX numbers from each cell.

How can this be done?

I found this formula:

Code:
=MATCH(10,INDEX(FIND(","&ROW(INDIRECT("1:99999"))&",",","&AH13&","),0))

But it only gives me the MAX, not MIN.

I saw some VBA solutions but could not get them to work.
 
How about
+Fluff 1.xlsm
ABC
1DataExpected Result Min (Non Zero)Expected Result Max
23897,2561,0,0,0,0,0,0,,,,5767,4479,3221,0,0,0,0,0,295,295,,,,,3677,,,,,,,,,,,2955767
30,0,,0,0,0,0,0,00
4,00
50,,,,,,,,,,,,,,00
60,0,0,130,0,130,130,130,0130
70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4267,1862,0,0,0,0,0,0,0,0,0,0,0,0,,,0,0,18624267
80,0,1629,2705,3772,3167,1048,0,0,0,0,0,0,0,0,0,10483772
90,76937,0,0,0,0,0,0,0,0,0,0,0,0,076937
100,0,0,1047,0,1047,1047,1047,,,,01047
Main
Cell Formulas
RangeFormula
B2:B10B2=LET(f,FILTERXML("<k><m>"&SUBSTITUTE(TRIM(SUBSTITUTE(A2,","," "))," ","</m><m>")&"</m></k>","//m[.>0]"),IFERROR(IF(MAX(f)=MIN(f),0,MIN(f)),0))
C2:C10C2=LET(f,FILTERXML("<k><m>"&SUBSTITUTE(TRIM(SUBSTITUTE(A2,","," "))," ","</m><m>")&"</m></k>","//m[.>0]"),IFERROR(MAX(f),0))
Super Thanks.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You're welcome & thanks for the feedback.
 
Upvote 0
I have another related problem. Not sure if I should start a new thread on this. Please advice.

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

In the last row 054 and 023 are the two data points and the max and min are obviously 054 and 023 respectively
 
Upvote 0
This will need a new thread. Thanks
 
Upvote 0
In relation to the MIN/MAX question, you may not have it yet but there is a new TEXTSPLIT function being rolled out to 365 subscribers. With it, you would also have options like this.

22 04 21.xlsm
ABC
1DataExpected Result Min (Non Zero)Expected Result Max
23897,2561,0,0,0,0,0,0,,,,5767,4479,3221,0,0,0,0,0,295,295,,,,,3677,,,,,,,,,,,2955767
30,0,,0,0,0,0,0,00
4,00
50,,,,,,,,,,,,,,00
60,0,0,130,0,130,130,130,0130
70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4267,1862,0,0,0,0,0,0,0,0,0,0,0,0,,,0,0,18624267
80,0,1629,2705,3772,3167,1048,0,0,0,0,0,0,0,0,0,10483772
90,76937,0,0,0,0,0,0,0,0,0,0,0,0,076937
100,0,0,1047,0,1047,1047,1047,,,,01047
Min Max
Cell Formulas
RangeFormula
B2:B10B2=LET(ts,(0&TEXTSPLIT(A2,","))+0,IFNA(MIN(FILTER(ts,(ts<>0)*(ts<>C2),NA())),0))
C2:C10C2=LET(ts,(0&TEXTSPLIT(A2,","))+0,IFNA(MAX(FILTER(ts,ts<>0,NA())),0))
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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