+ Reply to Thread
Results 1 to 5 of 5

Formula Help - Multiple lines into one line with pipes

  1. #1
    Registered User
    Join Date
    05-22-2019
    Location
    Bury, England
    MS-Off Ver
    2016
    Posts
    2

    Question Formula Help - Multiple lines into one line with pipes

    Good afternoon all,

    I have a unique issue and was wondering if there was any way a formula could help.

    0612020/WHITE/XL PM3.B1.H.01
    0612020/WHITE/XL PM3.B1.LOC.12
    0612020/WHITE/XL PM3.B1.PROC.1
    0612020/WHITE/XL PM3.P.N.72.D
    0612020/WHITE/XL PM3.P.Q.38.D
    063560030/WHITE/2XL PM3.P.N.45.D
    063560030/WHITE/2XL PM3.P.N.71.C
    063560030/WHITE/L PM3.B1.LOC.6
    063560030/WHITE/L PM3.B2.Z.01
    063560030/WHITE/L PM3.P.O.21.C
    063560030/WHITE/L PM3.P.O.56.C


    I have the above data on a spreadsheet and need to condense it to the below (If column A = duplicates, then take the relevant values from column B and add a pipe between them.)

    0612020/WHITE/XL PM3.B1.H.01 PM3.3B.A|PM3.B1.H.01|PM3.B1.LOC.12|PM3.B1.PROC.1|PM3.P.N.72.D|PM3.P.Q.38.D
    0612020/WHITE/XL PM3.B1.LOC.12
    0612020/WHITE/XL PM3.B1.PROC.1
    0612020/WHITE/XL PM3.P.N.72.D
    0612020/WHITE/XL PM3.P.Q.38.D
    063560030/WHITE/2XL PM3.P.N.45.D PM3.P.N.45.D|PM3.P.N.71.C
    063560030/WHITE/2XL PM3.P.N.71.C
    063560030/WHITE/L PM3.B1.LOC.6 PM3.B1.LOC.6|PM3.B2.Z.01|PM3.P.O.21.C|PM3.P.O.56.C
    063560030/WHITE/L PM3.B2.Z.01
    063560030/WHITE/L PM3.P.O.21.C
    063560030/WHITE/L PM3.P.O.56.C

    Is there a formula that can help with this?

    Kind Regards,
    Last edited by metz=uk; 05-22-2019 at 10:45 AM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Formula Help - Multiple lines into one line with pipes

    Assuming data starts as A2.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Confirmed as array (CTRL + SHIFT + ENTER)

    If TEXTJOIN isn't available in your Excel version... use PowerQuery to perform self join.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Formula Help - Multiple lines into one line with pipes

    PQ steps:
    1. Load range to PQ. Go to editor.
    2. Copy and paste the query.
    3. In copied query. Group by Column1, All Rows (temp).
    4. Add custom column (Custom) with following:
    Please Login or Register  to view this content.
    5. Add another custom column (Custom.1):
    Please Login or Register  to view this content.
    6. Back in original query, Merge Queries. Using original's [Column2] and copy's [Custom] as key and left outer join.
    7. Expand merged query for [Custom.1].

    See attached sample.
    Attached Files Attached Files

  4. #4
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: Formula Help - Multiple lines into one line with pipes

    Hi, to both!

    Another option, with helper "D" column (works in any Excel version):

    [D2] : =B2&IF(A2=A3,"|"&D3,"")
    [C2] : =IF(A1=A2,"",D2)

    And drag it down.

    Check file with the option applied. Blessings!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-22-2019
    Location
    Bury, England
    MS-Off Ver
    2016
    Posts
    2

    Re: Formula Help - Multiple lines into one line with pipes

    Brilliant, thank you guys! Both ways are working :D

+ 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] Transposing from multiple lines to single line with multiple related columns
    By Seattlites in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-21-2017, 07:32 PM
  2. Line graphs with multiple lines
    By stretch90 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 11-14-2013, 12:27 PM
  3. [SOLVED] Content of multiple lines, into one line.
    By koenus in forum Excel General
    Replies: 9
    Last Post: 07-11-2012, 06:05 AM
  4. Multiple Lines into One Line
    By yoshilily in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-02-2012, 07:13 AM
  5. line graph help - multiple lines
    By chsl2008 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-24-2011, 06:58 AM
  6. Line Graph: multiple lines from multiple data sets?
    By Guerodemonio in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-28-2011, 06:15 AM
  7. Multiple lines to one line
    By Ron1121 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2009, 03:04 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