ATEXTSPLIT

ATEXTSPLIT(Array,Delimiter,Info_Type,nRows,nCols)
Array
Required. Array to return delimited value count.
Delimiter
Optional. Value separator(s); ignored☛ space. Can be an array of separators but the number of rows and/or columns must match text array.
Info_Type
Optional. 0 or ignored☛ Split Text, 1☛ Value Count, 2☛ Delimiter Positions, 3☛Value Positions, or 4☛ Value Lengths.
nRows
Optional. Row numbers to return for final result; 0 or ignored☛ all rows.
nCols
Optional. Column numbers to return for final result; 0 or ignored☛ all columns.

ATEXTSPLIT splits delimited values from a one dimensional array, or returns the value count, delimiter positions, value positions, or value lengths.

schardt679

Board Regular
Joined
Mar 27, 2021
Messages
58
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
ATEXTSPLIT splits delimited values from a one dimensional array, or returns the value count, delimiter positions, value positions, or value lengths.

Thanks to XLambda's ATTSPLIT & ATEXTSPLIT functions, GeertD's GETONDELIMITER & SPLITONDELIMITER functions, and ExcelIsFun's/Mr. Excels' Dueling Excel #192 for the inspiration.
Similar to other Excel text functions, values are returned as text.
Invalid arguments return error messages. Blanks/ errors are returned for Split.
If the delimiter isn't found, Value Count= 1, Delimiter Positions= 0, Value Positions= 1, and Lengths= string length.
Optional arguments require comma to work. Calls AONEDIM, ATRIM, & CELLCOUNT.
Other functions on minisheet: AFORMULATEXT.

Screen Tip/ Comment: =ATEXTSPLIT(Array☛ range, [Delimiter]☛ separator char; ❎=" "✅, [Info_Type]☛ 0/❎=Split ❔✅; 1=❔Count; 2=Delimiter?; 3=❔?; 4=❔Length, [nRows]☛ row index; ❎=0✅, [nCols]☛ column index; ❎=0✅) ⁂[]=optional: use ","; ✅=default; ❎=omit; ?=position; ❔=value

Excel Formula:
=LAMBDA(Array,Delimiter,Info_Type,nRows,nCols,
      LET(Arr, Array&"",          Info, N(IFERROR(Info_Type,)),          nRow, N(IFERROR(nRows,)),          nCol, N(IFERROR(nCols,)),
             A1D?, AONEDIM(Arr),          AScan, AND(A1D?<>{"H","V"}),          H?, A1D?="H",
             InfoScan, OR(Info<0, Info>4),          InfoMSG, "Info=0-4",
             NumScan, OR(MIN(nRow)<0, MIN(nCol)<0),          NumMSG, "nRows/nCols>=0",
             ERRORS, IFS(AScan, A1D?,  InfoScan, InfoMSG,  NumScan, NumMSG,  1, 0),
             Del, Delimiter,          D, CHAR(2),          D_, CHAR(3),          AD, ATRIM(Arr, Del),          DSub, SUBSTITUTE(AD, IF(Del="", " ", Del), D),
             A, IFERROR(DSub,),          ALen, LEN(A),          NoDLen, LEN(SUBSTITUTE(A, D, "")),          VCt, ALen - NoDLen + (A<>""),
             MaxCt, MAX(IF(VCt=0, 1, VCt)),          CellCt, CELLCOUNT(A,),          Seq, SEQUENCE(IF(H?, MaxCt, 1), IF(H?, 1, MaxCt)),
             RowSel, IF(H?, MaxCt, CellCt),          RowF, FILTER(nRow, nRow<=RowSel, 1),          AllRow?, IFNA(XMATCH(0, RowF),),
             ColSel, IF(H?, CellCt, MaxCt),          ColF, FILTER(nCol, nCol<=ColSel, 1),          AllCol?, IFNA(XMATCH(0, ColF),),
             RowSeq, IF(AllRow?, SEQUENCE(RowSel),  RowF),          ColSeq, IF(AllCol?, SEQUENCE(, ColSel),  ColF),
             DFind, FIND(D_, SUBSTITUTE(A&D, D, D_, Seq)),          VFind, FIND(D_, SUBSTITUTE(D&A, D, D_, Seq)),
             DPos, IF(((Info=2) * (Seq=VCt)) + (VCt<1),, DFind),          VPos, IF(VCt<1,, VFind),          VLen, ABS(DPos - VPos),
             Split, IF(Seq>VCt, "", MID(DSub, VPos, VLen)),          VC, INDEX(VCt, IF(H?, ColSeq, RowSeq)),
             PreRes, IFERROR(SWITCH(Info,  2, DPos,  3, VPos, 4, VLen,  Split), IF(Info=0, Split,)),
             Result, IF(Info=1, VC,  INDEX(PreRes, RowSeq, ColSeq)),          Return, IF(ERRORS<>0, ERRORS, Result),
             Return
      )
  )
LAMBDA Examples.xlsx
ABCDEFGHIJKLM
1ATEXTSPLIT
2
3Sample DataDelimiter:Result
4My name is Patrick.Info_Type:MynameisPatrick.
5I went to CalU of PA.nRows:IwenttoCalU
6I have 3 degrees.nCols:1Ihave3degrees.
7I am 27.2Iam27.
83
9#N/A4#N/A
10
11Data is a vertical array --> result spills horizontally
12Delimiter is " "☛ Char 32
13Values are split by delimiter
14All rows are returned
15Resultant columns 1-4 are returned
16Formula in cell G4☛ =ATEXTSPLIT(B4:B9, E3, E4, E5, TRANSPOSE(E6:E9))
17
18
19
20Sample DataDelimiter:|Result
21Group|Project|Start By|End ByInfo_Type:14
221|A|3/22/21|3/23/21nRows:21
23#VALUE!30
244
252|B2|3/22/21|3/25/21nCols:
263|C|3/23/21|3/25/21
274|D|3/23/21|3/23/21
285|E1|3/23/21|3/26/21
295|E2|3/24/21|3/29/21
305|E3|3/25/21|3/30/21
31
32Data is a vertical array --> result spills horizontally
33Delimiter is "|"☛ Char 124
34Delimited values are counted
35Resultant rows 2-4 are returned
36All columns are returned
37Formula in cell G21☛ =ATEXTSPLIT(B21:B30, E20, E21, E22:E24, E25)
38
39
40
41Sample Data
42A|BC|DEFGHIJ|JKLM1+2+3+45+6+7+8+9+10
43
44Delmiter:|
45|
46+
47+
48Info_Type:2
49nRows:
50nCols:
51
52Result
532522
545044
550066
560008
5700010
580000
59
60Data is a horizontal array --> result spills vertically
61Delimiter 1 is "|"☛ Char 124; Del 2 is "+"☛ Char 43
62Delimiter positions are returned
63All Rows are returned
64All columns are returned
65Formula in cell B53☛ =ATEXTSPLIT(B42:E42, TRANSPOSE(C44:C47), C48, C49, C50)
66
67
68
69Sample DataDelmiter:|Result
70A|BC|DEF|136000
71GHIJ|JKLM+160000
721+2+3+4+135700
735+6+7+8+9+10Info_Type:31357911
74nRows:
75nCols:
76
77
78Data is a vertical array --> result spills horizontally
79Delimiter 1 is "|"☛ Char 124; Del 2 is "+"☛ Char 43
80Value positions are returned
81All Rows are returned
82All columns are returned
83Formula in cell G70☛ =ATEXTSPLIT(B70:B73, E69:E72, E73, E74, E75)
84
85
86
87Sample DataDelmiter:|Result
88A|BC|DEF|123000
89GHIJ|JKLM+440000
901+2+3+4+111100
915+6+7+8+9+10Info_Type:4111112
92nRows:
93nCols:
94
95
96Data is a vertical array --> result spills horizontally
97Delimiter 1 is "|"☛ Char 124; Del 2 is "+"☛ Char 43
98Value lengths are returned
99All Rows are returned
100All columns are returned
101Formula in cell G88☛ =ATEXTSPLIT(B88:B91, E87:E90, E91, E92, E93)
102
ATEXTSPLIT
Cell Formulas
RangeFormula
G4:J9G4=ATEXTSPLIT(B4:B9, E3, E4, E5, TRANSPOSE(E6:E9))
B16B16=AFORMULATEXT(G4)
G21:G23G21=ATEXTSPLIT(B21:B30, E20, E21, E22:E24, E25)
B37B37=AFORMULATEXT(G21)
B53:E58B53=ATEXTSPLIT(B42:E42, TRANSPOSE(C44:C47), C48, C49, C50)
B65B65=AFORMULATEXT(B53)
G70:L73,G88:L91G70=ATEXTSPLIT(B70:B73, E69:E72, E73, E74, E75)
B83,B101B83=AFORMULATEXT(G70)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

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