I have a table with three Columns: Column A: name of Item, Column B: Lowest value of series, Column C: the Highest value of series. enter image description here
What I want to achieve is:
So Apple 7 9 will yield: "Apple_7", "Apple_8", "Apple_9"
Concatenate/Join such sequence per row into Column D So
Item | From | Until | Result |
---|---|---|---|
Apple | 7 | 9 | "Apple_7, Apple_8, Apple_9" |
Berry | 3 | 8 | "Berry_3, Berry_4, Berry_5, Berry_6, Berry_7, Berry_8" |
Doing it all using one Arrayformula, so that new row added can be automatically calculated.
Here is example sheet: https://docs.google.com/spreadsheets/d/1R5raKmmt5-aOIorAZGHjv_-fdySKWjCMB_FRQwm1vag/edit#gid=0
I tried in Column D:
arrayformula(textjoin(", ",true,arrayformula(A3:A&"_"&sequence(1,C3:C-B3:B+1,B3:B,1))))
Apparently, the sequence function only take value from Column B and join it in first row.
Any help will be appreciated.
Try below BYROW()
formula (see your file, harun24hr sheet).
=BYROW(A3:INDEX(A3:A,COUNTA(A3:A)),LAMBDA(x,TEXTJOIN(";",1,INDEX(x&"_"& SEQUENCE(INDEX(C:C,ROW(x))-INDEX(B:B,ROW(x))+1,1,INDEX(B:B,ROW(x)))))))
Here A3:INDEX(A3:A,COUNTA(A3:A))
will return a array of values as well cell reference from A3 to last non empty cell in column A (Assume you do not have any blank rows inside data). If you have blank row, then you have to use different approach. See this post by @TheMaster
Then LAMBDA()
will apply TEXTJOIN() and SEQUENCE() function for each cell of B as well as C column.
SEQUENCE()
will make series from start to end number and by concatenating A column and will generate your desired strings.
Finally TEXTJOIN()
will join all those strings with delimiter to a single cell.