+ Reply to Thread
Results 1 to 20 of 20

Joining Array

  1. #1
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Joining Array

    Formulas aren't really my thing, but I'm trying to get better with them and I've run into a bit of a stumbling block. It feels like there should be a way to concatenate an array in formulas, but I can't work out how to do it and googling didn't turn up much.

    I posted the following formula to turn a string into buttons to press on a phone keypad to "dial" the text:
    PHP Code: 
    =INDEX(LOOKUP((1*(CODE(MID(UPPER($J2),ROW(INDIRECT("$1:$"&LEN($J2))),1)))),{65,68,71,74,77,80,84,87},ROW($2:$9)),COLUMN(A$1)) 
    Whilst it works, it requires dragging across so that you get one number in each cell - which is a bit of a pain, so my question is whether there is a way to concat the array to return a string with all the array values - I know concat doesn't work (and I can't actually find a useful application of concatenate anyway), but is there any nifty way of doing something like the below?
    PHP Code: 
    =CONCATENATE(LOOKUP((1*(CODE(MID(UPPER($J2),ROW(INDIRECT("$1:$"&LEN($J2))),1)))),{65,68,71,74,77,80,84,87},ROW($2:$9))) 
    Ta muchly

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Joining Array

    Pretty sure you need a user defined function for that.

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Joining Array

    Hi Kyle123
    Can you post a copy of your worksheet so we can take a look.
    Tony

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Joining Array

    @yudlugar thanks , bit rubbish if that's the case though

    @ARGK I don't have one, for the above, assume that J2 contains any text only string, e.g "Kyle"

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Joining Array

    Hi Kyle,

    Try:

    =SUMPRODUCT(10^(LEN($J2)-ROW(INDIRECT("$1:$"&LEN($J2))))*LOOKUP((1*(CODE(MID(UPPER($J2),ROW(INDIRECT("$1:$"&LEN($J2))),1)))),{65,68,71,74,77,80,84,87},ROW($2:$9)))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Joining Array

    Strange. My last post doesn't seem to have registered.

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Joining Array

    Ah that's really clever, I'd have never thought about multiplying it out and summing it like that I'm guessing from your reply that there's no simple nifty concat function that I don't know about then?

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Joining Array

    Unfortunately not. This type of 'workaround' will only work on numerical concatenation (and only in specific cases).

    And unless Microsoft have got round to it in 2013 (which I doubt), us worksheet function-users will continue to be left mystified as to why a concatenating function which can be passed arrays is still not in existence.

    Guess that leaves multiple string-concatenation firmly in the VBA field for the time being.

    Regards

  9. #9
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    I use frequently this excellent UDF to concatenate arrays/ranges

    Please Login or Register  to view this content.
    Marcelo Branco

  10. #10
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Example


    A
    B
    C
    D
    E
    1
    Employee
    Dept
    Dept
    Employees
    2
    Anthony
    Dept1
    Dept1
    Anthony, Barbara, Bob
    3
    Barbara
    Dept1
    Dept2
    Charles, Diana, Mike
    4
    Bob
    Dept1
    Dept3
    Mark, Richard, Robert, William
    5
    Charles
    Dept2
    6
    Diana
    Dept2
    7
    Mike
    Dept2
    8
    Mark
    Dept3
    9
    Richard
    Dept3
    10
    Robert
    Dept3
    11
    William
    Dept3


    Array formula in E2 copied down
    =SUBSTITUTE(Aconcat(IF($B$2:$B$11=D2,", "&$A$2:$A$11,"")),", ","",1)
    Ctrl+Shift+Enter

  11. #11
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Joining Array

    Once i have come to know.. that a Excel Expert goes to COMA, when he trying to reverse a string using formula..

    hope, this time, i will live experience the same.. convert a string to Phonetic Number..
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  12. #12
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Quote Originally Posted by Debraj Roy View Post
    Once i have come to know.. that a Excel Expert goes to COMA, when he trying to reverse a string using formula..

    hope, this time, i will live experience the same.. convert a string to Phonetic Number..
    Hi

    Reverse a string is not so tough, but what you mean by convert a string to Phonetic Numbers? (sorry for my ignorance...)

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Joining Array

    Marcelo,

    Check out this UDF:

    http://www.excelforum.com/tips-and-t...geravatar.html

    The resultant formulas are much simpler than the equivalent formulas needed by using the aconcat/mconcat UDFs.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  14. #14
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Quote Originally Posted by Tony Valko View Post
    Marcelo,

    Check out this UDF:

    http://www.excelforum.com/tips-and-t...geravatar.html

    The resultant formulas are much simpler than the equivalent formulas needed by using the aconcat/mconcat UDFs.
    Tony,

    Thank you for the link.

    I think you are talking about post 13 (jindon's functions), right?
    They really make the result formula much simpler.

    Next step: understand how they work

    M.

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Joining Array

    I was referring to the UDFs by tigeravatar.

    The code is more extensive and accounts for the most common conditions when wanting to conditionally concatenate ranges. Most of the processing is done within the UDF which allows for simple formulas.

  16. #16
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Joining Array

    Hi marcelo..

    Guru want to convert a name to this..

    phone-keypad.jpg

    I mean ICICI's USA's customer care Number is ..

    1-866-ICICI-4U
    which is 1-866-424-2448

    USING FORMULA..

    PS: BTW, I will love to learn "Reverse a string" using formula..
    Last edited by Debraj Roy; 09-24-2013 at 09:37 AM.

  17. #17
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Reverse a string using a formula (uses UDF Aconcat above in #9)


    A
    B
    1
    abcde ghi klm
    mlk ihg edcba
    2
    123456789 adhb
    bhda 987654321
    3
    1a 2b 3c 4d 5e
    e5 d4 c3 b2 a1


    Array formula in B1 copied down
    =Aconcat(MID(A1,LEN(A1)-ROW(INDIRECT("1:"&LEN(A1)))+1,1))

  18. #18
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Maybe something like this

    Make a table in, say, D1:E36 like below - note that the numbers in blue in column D are entered as text, i.e., '0 '1 '2....


    D
    E
    1
    0
    0
    2
    1
    1
    3
    2
    2
    4
    3
    3
    5
    4
    4
    6
    5
    5
    7
    6
    6
    8
    7
    7
    9
    8
    8
    10
    9
    9
    11
    A
    2
    12
    B
    2
    13
    C
    2
    14
    D
    3
    15
    E
    3
    16
    F
    3
    17
    G
    4
    18
    H
    4
    19
    I
    4
    20
    J
    5
    21
    K
    5
    22
    L
    5
    23
    M
    6
    24
    N
    6
    25
    O
    6
    26
    P
    7
    27
    Q
    7
    28
    R
    7
    29
    S
    7
    30
    T
    8
    31
    U
    8
    32
    V
    8
    33
    W
    9
    34
    X
    9
    35
    Y
    8
    36
    Z
    9




    A
    B
    1
    1-866-ICICI-4U
    1-866-424-2448
    2
    1-800-PRINT-ME
    1-800-774-6863
    3
    1-800-FLOWERS
    1-800-356-9377
    4
    1-800-APL-CARE
    1-800-275-2273


    Array formula in B1 copied down
    =TEXT(Aconcat(LOOKUP(MID(SUBSTITUTE(A1,"-",""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(A1,"-","")))),1),$D$1:$D$36,$E$1:$E$36)),"0-000-000-0000")
    confirmed with Ctrl+Shift+Enter
    Last edited by mlcb; 09-24-2013 at 11:23 AM.

  19. #19
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Quote Originally Posted by mlcb View Post
    Reverse a string using a formula (uses UDF Aconcat above in #9)


    A
    B
    1
    abcde ghi klm
    mlk ihg edcba
    2
    123456789 adhb
    bhda 987654321
    3
    1a 2b 3c 4d 5e
    e5 d4 c3 b2 a1


    Array formula in B1 copied down
    =Aconcat(MID(A1,LEN(A1)-ROW(INDIRECT("1:"&LEN(A1)))+1,1))
    Sorry, this is silly. VBA has a function that reverts a string.

    Please Login or Register  to view this content.
    Using just formulas i think it's really tough (i dont want to go into a COMA )

    M.

  20. #20
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Joining Array

    Quote Originally Posted by Tony Valko View Post
    I was referring to the UDFs by tigeravatar.

    The code is more extensive and accounts for the most common conditions when wanting to conditionally concatenate ranges. Most of the processing is done within the UDF which allows for simple formulas.
    Tony,

    I'll take a look at tigeravatar's function.

    M.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hi I'm just joining
    By alamar in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-11-2013, 10:33 AM
  2. Joining you!
    By Zymag in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-17-2012, 08:47 AM
  3. joining and passing 2 range.areas.formula to an array index
    By junoon in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-03-2012, 10:34 AM
  4. Joining data
    By Slowleft in forum Excel General
    Replies: 1
    Last Post: 08-27-2010, 09:26 AM
  5. Joining them together
    By misc1992 in forum Excel General
    Replies: 1
    Last Post: 01-29-2009, 11:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1