Array to return Multiple Results (maybe byrow function)

pto160

Active Member
Joined
Feb 1, 2009
Messages
482
Office Version
  1. 365
Platform
  1. Windows
I am trying to use Textsplit with byrow to return multiple results, but I am getting a CALC error. Ignore the name error. This is my personal computer. The ":" is the delimiter.

Book1
AB
1Product
21800:9400
32400:2500
4
5#NAME?
6
7Result I would like
81800
99400
102400
112500
Sheet1
Cell Formulas
RangeFormula
B5B5=BYROW(A2:A3,LAMBDA(x,TEXTSPLIT(x,,":")))
 
I have been using this formula at work. Is it possible to add a third column for the check date?

Book1
ABC
1ProductCheckCheck Date
21800:9400:1600:80014458/8/2024
31800:2400144610/10/2024
4
5
6
7Result I would likeI would like to add this column
8ProductCheckCheck Date
9180014458/8/2024
10940014458/8/2024
11160014458/8/2024
1280014458/8/2024
131800144610/10/2024
142400144610/10/2024
Sheet1
Cell Formulas
RangeFormula
A9:B14A9=LET( ct,VSTACK(0,BYROW(A2:A3,LAMBDA(br,COLUMNS(TEXTSPLIT(br,":"))))), t,TEXTSPLIT(TEXTJOIN(":",TRUE,A2:A3),,":"), l,XLOOKUP(SEQUENCE(SUM(ct)),SCAN(1,ct,LAMBDA(a,b,a+b)),B2:B4,,-1), HSTACK(t,l))
Dynamic array formulas.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Another option is to use a "text to columns / unpivot" approach:

Excel Formula:
=LET(
    a, A2:A3,
    b, B2:C3,
    t, TEXTBEFORE(TEXTAFTER(":"&a&":",":",SEQUENCE(,MAX(LEN(a)-LEN(SUBSTITUTE(a,":",)))+1)),":"),
    HSTACK(TOCOL(t,2),CHOOSEROWS(b,TOCOL(IFS(NOT(ISERROR(t)),SEQUENCE(ROWS(a))),2)))
)

TEXTBEFORE-TEXTAFTER (with multiple [instance_num]s) will split the delimited data into an array. Items with fewer delimiters than the item with the most delimiters will have their extra columns filled with errors. TOCOL then ignores these errors with the optional [ignore] argument set to 2, and CHOOSEROWS returns the applicable data by referencing the row number of the original table.

Adjust the a & b range references as needed.
 
Upvote 0
A very elegant and dynamic formula. Absolutely fantastic. Thank you so much djclements. This will save me so much time at work. (y) :)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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