+ Reply to Thread
Results 1 to 4 of 4

Combine multiple columns within multiple rows based on value of a column up until change i

  1. #1
    Registered User
    Join Date
    04-16-2021
    Location
    NYC
    MS-Off Ver
    2019
    Posts
    2

    Combine multiple columns within multiple rows based on value of a column up until change i

    Referring to the attached image with sample data, I would like to combine date, person, and note from multiple rows into 1 row with line breaks for each set of combined values. Each note takes up a row with Name and ID blank, so every row under the main row with values will need to be combined. See attached image for data, and desired output.

    Each ID is unique, and all rows below that are date, person, and note aligned. Some users will not have any notes. All notes are enclosed in paragraph tag, and that needs to be removed as well.

    Thank you!

    EDIT: Used the following M code in Power Query

    HTML Code: 
    Last edited by enyceexdanny; 04-17-2021 at 11:35 PM.

  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,885

    Re: Combine multiple columns within multiple rows based on value of a column up until chan

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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
    Registered User
    Join Date
    04-16-2021
    Location
    NYC
    MS-Off Ver
    2019
    Posts
    2

    Re: Combine multiple columns within multiple rows based on value of a column up until chan

    Of course. Sorry about that.
    Attached XLS: 1st sheet is sample data, 2nd sheet is mock-up.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,563

    Re: Combine multiple columns within multiple rows based on value of a column up until chan

    Perhaps someone will be able to put all of this into the power query code.
    The code listed in post #1 was appended to read:
    Please Login or Register  to view this content.
    The resulting table (top of Table3 sheet) is used as an intermediate step
    The Name:Person columns are copied using the formula: =IF(A1="","",A1)
    The Notes column (not the header) is transposed using: =SUBSTITUTE(SUBSTITUTE(E2,"<p>",""),"</p>",CHAR(13))
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] How to combine data from multiple rows into a single row / multiple columns
    By Iain170 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2020, 06:56 AM
  2. [SOLVED] Combine multiple First/Last Name columns into one column, data can contain blank rows
    By Tunesmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-04-2016, 09:42 AM
  3. Combine multiple rows in a specific column based on matching criteria? VBA solution?
    By hopegriffin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2015, 07:11 PM
  4. Combine Data in Multiple Columns to One Column Based on Data in Rows
    By exceldivx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-09-2014, 07:35 AM
  5. Replies: 6
    Last Post: 02-19-2014, 10:25 AM
  6. Replies: 0
    Last Post: 07-31-2006, 12:13 PM
  7. Change a Column list into multiple rows & columns
    By angelface in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-27-2006, 09:30 PM

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