+ Reply to Thread
Results 1 to 4 of 4

Concatenate data in different cells and add a comma

  1. #1
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Concatenate data in different cells and add a comma

    Hello all,

    I had data in column A like so:

    689
    805
    806
    807
    808
    809
    1281
    1411
    1412
    1413
    1414
    1415
    1416
    1417
    1418
    1419
    1420
    1421
    1422
    1423
    1424
    1425
    1426


    I have then used a transpose function to put it in a row: 689 805 806 807 808 809 1281 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426


    Now I want to use a concatenate function to have a comma between each number. Is there a suggestion on how to do this please?

    Thank you!
    Thanks,

    R.



  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Concatenate data in different cells and add a comma

    Using Power Query/ Get and Transform found on the Data Tab

    Excel 2016 (Windows) 32 bit
    A
    1
    Merged
    2
    689,805,806,807,808,809,1281,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425
    Sheet: Sheet2

    Mcode to get this result

    Please Login or Register  to view this content.
    Review PQ
    In the attached file
    Click on any cell in the new table
    On the Data Tab, click on Queries & Connections
    In the right window, double click to open Query
    Review PQ steps

    M-code basics:
    - "let" is the start of a query
    - "in" is the closing of a query
    - each transformation step sits in between those 2 lines
    - each step line is ended by a comma, except the last one
    - "Source" is always the first step (Source Data)
    - After "in" you have the last step referenced
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Concatenate data in different cells and add a comma

    Hi Alan,

    Looks great, will try and get my head round this more. Thank you!

  4. #4
    Forum Contributor
    Join Date
    03-18-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    251

    Re: Concatenate data in different cells and add a comma

    Hi,

    use power query will be straight forward

    Please Login or Register  to view this content.

    or

    in any cell, type =TRANSPOSE(A1:A5)&",", then press F9,
    Remove the curly brackets from both ends.
    Add =CONCATENATE( at the beginning of the text and end it with a round bracket).
    Press Enter

    or


    if you are using O365, can use =TEXTJOIN(",",TRUE,A1:A24)
    Attached Files Attached Files
    Christopher Yap

+ 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. [SOLVED] Group & concatenate data in comma seperated format
    By aashishni in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-19-2018, 08:29 AM
  2. How do I concatenate value with comma and ignore if null value
    By cyee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2018, 04:41 AM
  3. [SOLVED] Concatenate thousands of cells with a comma between each one?
    By MetroBOS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2016, 08:27 AM
  4. Replies: 2
    Last Post: 05-23-2014, 06:49 PM
  5. Replies: 2
    Last Post: 03-31-2014, 02:07 PM
  6. [SOLVED] CONCATENATE Multiple Cells into One with Comma
    By Karen615 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-16-2013, 03:30 PM
  7. Replies: 7
    Last Post: 11-17-2010, 01:00 PM

Tags for this Thread

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