+ Reply to Thread
Results 1 to 9 of 9

CONCATENATE formula

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2016
    Posts
    153

    CONCATENATE formula

    is there a way to automate a cell to count the number of cells with content and group them all separated by a | symbol?

    for example, in the attachment i want the formula in cell AA. i already put the end result i want to see in Cell. i have done this by manually concatenateing all the cells manually but sometimes i get a result like 1|2|3|4|5|6|7||||||||||||||||||||||||||||. my meager result has all the extra |.
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: CONCATENATE formula

    this is one (ugly) way.
    PHP Code: 
    =IF(AND($B2<>"",$C2=""),B2,IF(AND($B2<>"",$C2<>"",$D2=""),B2&"|"&C2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2=""),B2&"|"&C2&"|"&D2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2=""),B2&"|"&C2&"|"&D2&"|"&E2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2<>"",G2=""),B2&"|"&C2&"|"&D2&"|"&E2&"|"&F2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2<>"",G2<>"",H2=""),B2&"|"&C2&"|"&D2&"|"&E2&"|"&F2&"|"&G2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2<>"",G2<>"",H2<>"",I2=""),B2&"|"&C2&"|"&D2&"|"&E2&"|"&F2&"|"&G2&"|"&H2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2<>"",G2<>"",H2<>"",I2<>"",J2=""),B2&"|"&C2&"|"&D2&"|"&E2&"|"&F2&"|"&G2&"|"&H2&"|"&I2,IF(AND($B2<>"",$C2<>"",$D2<>"",E2<>"",F2<>"",G2<>"",H2<>"",I2<>"",J2<>"",K2=""),B2&"|"&C2&"|"&D2&"|"&E2&"|"&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L2&"|"&M2&"|"&N2&"|"&O2&"|"&P2,""))))))))))))))) 
    It assumes you don't have values going past column P.

    (trying to paste it differently so it shows better.)
    HTML Code: 
    Last edited by Sam Capricci; 07-05-2019 at 04:19 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: CONCATENATE formula

    I suggest you use helper columns then take the last result. Using your sample file, do this:
    1. In AB2, put this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2. In AC2, put this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    3. Drag that formula along until you get to AZ2. There, it will look like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. Go back to column AA and enter this in AA2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    5. Drag the formula in AA2:AZ2 down as many rows as you need (to row 4 in your sample file).

    What this does is look at each cell in turn (of your original data) and, if there is something in the cell, concatenate that with a | separator before it. The second IF in the formula is there in case your data starts with some blank cells. If the first cell (B2) will never be blank, then you can replace the second IF statement with just " | ", giving you this for in AC2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You can then hide the helper columns. I've attached your file with this working, but the columns not yet hidden.
    Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: CONCATENATE formula

    Try this if you have TEXTJOIN function

    Enter as array formula in cell AA2 and copy down (must be entered with ctrl+shift+enter key combination.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AlKey; 07-05-2019 at 04:30 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: CONCATENATE formula

    Without textjoin,

    =SUBSTITUTE(TRIM(B2&" "&C2&" "&D2&" "&E2&" "&F2&" "&G2&" "&H2&" "&I2&" "&J2&" "&K2&" "&L2&" "&M2&" "&N2&" "&O2&" "&P2&" ")," ","|")

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: CONCATENATE formula

    Quote Originally Posted by AlKey View Post
    Try this if you have TEXTJOIN function

    Enter as array formula in cell AA2 and copy down (must be entered with ctrl+shift+enter key combination.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Or
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    without array confirmation.

    Without TEXTJOIN, a simple UDF will be easier to work with than a long formula that refers to each cell individually. Note that this, as with Bo_Ry's suggestion above will fail if there are spaces in the original data.
    Please Login or Register  to view this content.
    Then use the formula to call the UDF
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: CONCATENATE formula

    Another UDF possibility, from this thread: https://www.excelforum.com/excel-gen...ank-cells.html
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2016
    Posts
    153

    Re: CONCATENATE formula

    thank you all for the help. I am going to try all of these as they are all quite different!!! would like to learn how they all work.

    Cheers!

  9. #9
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: CONCATENATE formula

    That's one of the great things about Excel - there are often a few different ways of achieving what you want.
    If you need more information about one or more of the above, just let us know.

+ 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] Drag CONCATENATE Formula or other formula till last cell in the spreadsheet
    By E5254730 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-23-2017, 10:51 AM
  2. Replies: 9
    Last Post: 11-19-2014, 04:15 PM
  3. Replies: 2
    Last Post: 08-24-2014, 04:56 AM
  4. Replies: 2
    Last Post: 04-12-2010, 12:35 PM
  5. Replies: 1
    Last Post: 05-20-2009, 08:15 AM
  6. Replies: 1
    Last Post: 05-20-2009, 07:56 AM
  7. Evaluating results of a concatenate formula, as a formula
    By dodger in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-09-2005, 09:05 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