Values disappear inconsistently when using TEXTSPLIT

bksbksbks

New Member
Joined
Nov 18, 2024
Messages
7
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
  3. Web
The following formula is working perfectly for me:
Excel Formula:
=XLOOKUP(TEXTSPLIT(XLOOKUP(J1,Overview.JobTitle,Overview.OrgLevel),"|"),'Split Assignment List'!$B3:$ZZ3,'Split Assignment List'!$B4:$ZZ4,"")

It generates the following value:
Excel Formula:
Job1|Job2|Job3|Job4

When I wrap the code within a TEXTSPLIT, however, instead of splitting the values into rows (or columns, as I have attempted both), the extra values disappear. The following formula:
Excel Formula:
=TEXTSPLIT(XLOOKUP(TEXTSPLIT(XLOOKUP(J1,Overview.JobTitle,Overview.OrgLevel),"|"),'Split Assignment List'!$B3:$ZZ3,'Split Assignment List'!$B4:$ZZ4,""),,"|")

generates only the value Job1. The thing that makes it especially frustrating, though, is that when I leave the formula without the TEXTSPLIT and reference it in another cell (say the formula is in A1), the result is perfect. This code:
Excel Formula:
=TEXTSPLIT(A1,,"|")
Generates the desired result:
Excel Formula:
Job1
Job2
Job3
Job4

Is there a part of the TEXTSPLIT formula that would eat the other values? I have not encountered this any other time while using the formula.

Thanks for your help!
 
Interesting - it's treating the 1 cell as an array. The behavior would make sense for more than 1 cell like below. Not sure if this is intended or a bug.
Book1
AB
1Job5|Job6Job7|Job8
2Job5Job7
Sheet5
Cell Formulas
RangeFormula
A1:B1A1={"Job5|Job6","Job7|Job8"}
A2:B2A2=TEXTSPLIT(A1#,"|")
Dynamic array formulas.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
it's treating the 1 cell as an array.
Yes, I mentioned that in post 6. :)

INDEX solved the problem!
Are you sure? I am having second thoughts. :unsure:

Your original formulas included this structure TEXTSPLIT(XLOOKUP(J1,Overview.JobTitle,Overview.OrgLevel),"|")
The use here of TEXTSPLIT implies that the value returned from Overview.OrgLevel by the XLOOKUP might itself include one or more "|" characters. If it did include any "|" characters then there would be more than one value being looked for in row 3 of 'Split Assignment List' and therefore more than one value being returned from row 4 of that sheet. If that is the case then my INDEX idea would not return all values.

Consider this

bksbksbks.xlsm
ABCD
3zyx
4Job5|Job6|Job7Job2Job4|Job8
Split Assignment List


In the sheet below you will see that the yellow and blue are the named ranges.
The example I outlined in post 10 results in the (correct) values in J3:J5

However, in column K the INDEX suggestion that I made only returns 2 values (in K3:K4) from the lookup of "x" in the other sheet. It does not include the values from looking up "y" and "z" as well.
I'm thinking that the formulas in J7 and K7 might be what you actually want to return all values from all lookups on the 'Split Assignment List' sheet?
All that of course depends on whether data like my sample is possible?

bksbksbks.xlsm
IJKLMN
1ab
2az
3Using INDEXJob5Job4bx|y|z
4Job6Job8
5Job7
6
7Using TEXTJOIN againJob5Job4
8Job6Job8
9Job7Job2
10Job5
11Job6
12Job7
13
Sheet1
Cell Formulas
RangeFormula
J3:J5,K3:K4J3=TEXTSPLIT(INDEX(XLOOKUP(TEXTSPLIT(XLOOKUP(J1,Overview.JobTitle,Overview.OrgLevel),"|"),'Split Assignment List'!$B3:$ZZ3,'Split Assignment List'!$B4:$ZZ4,""),1),,"|")
J7:J9,K7:K12J7=TEXTSPLIT(TEXTJOIN("|",1,XLOOKUP(TEXTSPLIT(XLOOKUP(J1,Overview.JobTitle,Overview.OrgLevel),"|"),'Split Assignment List'!$B3:$ZZ3,'Split Assignment List'!$B4:$ZZ4,"")),,"|")
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Overview.JobTitle=Sheet1!$M$1:$M$4J7:K7, J3:K3
Overview.OrgLevel=Sheet1!$N$1:$N$4J7:K7, J3:K3
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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