google spreadsheet: join arrays using function NOT CODE

后端 未结 7 1333
我寻月下人不归
我寻月下人不归 2021-02-05 03:52

I have one array

1 
2
3

another array

4
5
6

How do I use one function to join the 2 arrays?

         


        
相关标签:
7条回答
  • 2021-02-05 03:56
    =filter({A1:A;B1:B}, {A1:A;B1:B}<>"")
    
    0 讨论(0)
  • 2021-02-05 03:59
    TRANSPOSE() //takes matrix as argument and returns transposed matrix
    SPLIT() //breaks apart a string based on a delimiter character (char(13) here)
    ARRAYFORMULA() //applies the formula within to array vs cell
    CONCATENATE() //joins each cell in each range with a char(13), then the next cell...then the next matrix of cells (to which the first process also happens)
    //note char(13) is a carriage return, i will call CR for ease
    

    so if you have matrix A : 1, 2, 3 and matrix B : 4, 5, 6

    the steps would look like this:

    TRANSPOSE(SPLIT(ARRAYFORMULA(CONCATENATE("1CR2CR3CR" ; "4CR5CR6CR")), CR))
    TRANSPOSE(SPLIT("1CR2CR3CR4CR5CR6CR", "CR"))
    TRANSPOSE({"1","2","3","4","5","6"})
    

    finally:

    1
    2
    3
    4
    5
    6
    
    0 讨论(0)
  • 2021-02-05 04:03

    I found this even easier...

    =ARRAYFORMULA({A:A;B:B})
    
    0 讨论(0)
  • 2021-02-05 04:10

    I'm noticing this is an older question, so this might not have existed when previous responses were written.

    You're looking for the JOIN() formula.

    (Documentation link)

    Sample Usage

    JOIN(" and-a ",{1,2,"1 2 3 4"})
    
    JOIN(",",{1,2,3},{4;5;6})
    
    JOIN("-",A1:A100)
    

    Syntax

    JOIN(delimiter, value_or_array1, [value_or_array2, ...])
    

    delimiter - The character or string to place between each concatenated value.

    delimiter may be specified as blank, e.g. JOIN(,{1,2,3}). value_or_array1 - The value or values to be appended using delimiter.

    value_or_array2, ... - [ OPTIONAL ] - Additional value or array to be appended using delimiter.

    0 讨论(0)
  • 2021-02-05 04:14

    Let's say your arrays are:

    A1:A3 = {1;2;3} and B1:B3 = {4;5;6}

    Write somewhere: ={A1:A3;B1:B3}

    Semicolons ; are used to separate rows, and commas , are for columns.

    Here is the documentation: Using arrays in Google Sheets

    0 讨论(0)
  • 2021-02-05 04:14

    Given the information provided by Mr.Monshaw, I figured this out for you.

    Given values "1,2,3" are in cells A1:A3 of a spreadsheet, and values "4,5,6,7" are in cells B1:B4. Here is the formula to use:

    =TRANSPOSE(SPLIT(ARRAYFORMULA(CONCATENATE(concat(A1:A3,",");concat(B1:B4,","))),","))

    Explanation. The concat formula creates a string of the values with the indicated separator, ",". So concat(A1:A3,",") results in "1,2,3".

    The Concatenate combines the values of the specified array as one string. So CONCATENATE(concat(A1:A3,",");concat(B1:B4,",")) results in "1,2,3,4,5,6,7"

    The Split function here is used to identify the "," as a deliminator and not a value in the array. The Transpose will cause the results to display in a column instead of in a row.

    0 讨论(0)
提交回复
热议问题