Forum Discussion

Chloe_52's avatar
Chloe_52
Copper Contributor
Aug 15, 2022
Solved

xlookup to combine multiple values in single cell

Hi, I'm updating my office billing sheet to auto-fill most information based on the information I've already put in. I'm using an office 365 subscription on windows 11. I want to use xlookup to retur...
  • Chloe_52's avatar
    Chloe_52
    Aug 22, 2022

    mtarler 

    So it took me a minute to decipher your formula, as I'm still quite new to excel functions, but I think I've figured out a way to make it work. I had some trouble with the LET function, specifically in regards to "LL", as LEN(C1) returned 0 (at least in my workbook), which affected the rest of the calculation. I ended up googling "how to split a cell into an array" which resulted in this:

     

    =1*(TRIM(MID(SUBSTITUTE(A1,"#",REPT(" ",99)),IF(SEQUENCE(LEN(A1)-LEN(SUBSTITUTE(A1,"#",""))+1)=1,1,(SEQUENCE(LEN(A1)-LEN(SUBSTITUTE(A1,"#",""))+1)-1)*99),99)))

     

    I then adapted it to fit my data and replaced your LET function with a slightly more simplified one. It's not quite as adaptable as yours, but it does the trick:

     

     

    =IF(ISBLANK([@Date]),0,
        IF(ISNUMBER(SEARCH("hourly",[@[Fee Type]])),
           "hourly",
           SUM(INDEX(
             IFS([@Date]>=Pricing!D$6, Pricing!D$6:D$15,
                 [@Date]>=Pricing!E$6, Pricing!E$6:E$15),
             LET(inArray,TRIM(MID(SUBSTITUTE([@Service],",",REPT(" ",99)),IF(SEQUENCE(LEN([@Service])-LEN(SUBSTITUTE([@Service],",",""))+1)=1,1,(SEQUENCE(LEN([@Service])-LEN(SUBSTITUTE([@Service],",",""))+1)-1)*99),99)),
    IFERROR(
               XMATCH(inArray,Pricing!B$6:B$15),
               XMATCH(inArray,Pricing!C$6:C$15))
           )))
        )
      )

     

     

    I've also linked a workbook demo which I've removed most of the data from for reference. (please excuse the clunky formulas in other columns--I have yet to update them haha)

Resources