Search code examples
excelexcel-formuladynamic

EXCEL: Split comma separated values within a dynamic range


I have a tabel with comma separated values like

A B
title 1 10,2
title 2 3,4

This is a dynamic range. I need to split the value because i need to search the values in search for a specific value. I used TEXTSPLIT for this, but it doesn't work on a dynamic ranges. TEXTSPLIT only returns the first value if i use a range as the first parameter.

=TEXTSPLIT(B2:B3;",")

this returns

A
10
3

I got this working with the data > Text to columns option, but i need it in a formula.

Ultimately i need to filter the rows and only show a particular row based on a dynamic number. The formula I used:

=IFERROR(INDEX(
    FILTER(B2:B3;
        (IFERROR(ISNUMBER(SEARCH(2;B2:B3));FALSE))
    )
;;1);"")

This matches only the first value in the comma separated value. So i tried another formula.

=IFERROR(INDEX(
    FILTER(B2:B3;
        (IFERROR(ISNUMBER(SEARCH(2;B2:B3));FALSE))
    )
;;1);"")

This works, only problem is if i search for the number 1, the number 10 also hits.


Solution

  • =FILTER(B1:B5,MAP(B1:B5,LAMBDA(a,OR(VALUE(TEXTSPLIT(a,","))=2))))
    

    enter image description here