Convert A Long String To An Array, With Function Restrictions

mrblister

Board Regular
Joined
Nov 20, 2016
Messages
209
Office Version
  1. 2021
Platform
  1. Windows
Hello all,

I need a formula to convert a very long string into an array (delimiter is comma (",")).

When the string is converted into an array, the string segments are long (43 characters each). This causes issues with my current formula, because if there are over ~50 elements (string segments) in the array then my current formula fails. I believe the failure is due to the combination of REPT and SUBSTITUTE in my array formula creating an intermediary string that is larger than Excel's string size limits.

The string in A1 is in the format: "HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00012,HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00085,HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00129..."

My current formula in B1 is:
Excel Formula:
=LET(the_array,A1,num_items,LEN(the_array)-LEN(SUBSTITUTE(the_array,",",""))+1,TRIM(MID(SUBSTITUTE(the_array,",",REPT(" ",LEN(the_array))),(ROW(($A$1):INDEX($A:$A,num_items))-1)*LEN(the_array)+1,LEN(the_array))))

The formula creates an array in column B:
B1="HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00012"
B2="HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00085"
B3="HELLOHOWAREYOU.IAMFINE.ITCOSTS$34.000.00129"
... and so on. The strings are just examples. But there are special characters and numbers, but the string segments are all the same size (43 characters long).

NOTE: The system where this formula will be used, doesn't have access to the following functions: MAKEARRAY, TEXTSPLIT, FILTERXML.

Can someone please assist me in either replacing my current formula, or repairing the current formula so that it can handle larger text strings?

Thanks in advance!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Would this be any use?
Excel Formula:
=LET(the_array,A1,num_items,LEN(the_array)-LEN(SUBSTITUTE(the_array,",",""))+1,MID(the_array,SEQUENCE(num_items,,,44),43))

.. or without the names within LET, just
Excel Formula:
=MID(A1,SEQUENCE(LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1,,,44),43)
 
Upvote 0
Solution
Yes, thank you for your help! Both formulas are great and solve my problem. Cheers!
 
Upvote 0

Forum statistics

Threads
1,226,065
Messages
6,188,681
Members
453,490
Latest member
amru

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