+ Reply to Thread
Results 1 to 11 of 11

Combining multiple records, with unique value into one row

  1. #1
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Combining multiple records, with unique value into one row

    Hi All,

    I have an address report that comes out with the individual addresses (regular, mailing, shipping) as different records. Is there a formula that will allow me to pull them into one row.

    Example:

    If the student ID matches AND one of the Contact Types = _MailingAddress, then pull the Contact Address into the MailingAddress Cell, otherwise, pull the Reguler Address into the Mailing Address Cell
    AND
    If the Student ID matches AND one of the Contact Types = COA, then Add COA Pending in the Mailing2 Cell

    I have been going round and round with different formulas and none will do exactly what I need. I can't get the same data into the MailingAddress for each matching Student ID.

    I need to ensure that matching student IDs have the same information, so I can remove duplicates aftrer I have pulled all the data into the corresponding columns.

    Any Ideas? Sample Report is attached for your review.

    thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Combining multiple records, with unique value into one row

    Add a second sheet to your workbook showing how you want the data at the end of the process.... add comments to any changed cell as to 'why' that cell was changed.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Re: Combining multiple records, with unique value into one row

    Thank you for your assistance!


    I have added a new tab to the sample spreadsheet showing how I want the data to look and comments to explain what I'm trying to accomplish.

    There are three scenarios:

    1. Student has _MailingAddress listed as a Contact Type
    2. Student has _MailingAddress Listed as a Contact Type as well as COA listed as a Contact Type
    3. Student has COA Listed as a Contact Type
    4. Student Does Not have _MailingAddress or COA listed as a Contact Type
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Combining multiple records, with unique value into one row

    Your examples don't match your Sample Data - so I'm a bit confused - but these appear to be your rules:

    IF _MailingAddress and COA are both listed as a Contact Type THEN
    Copy the Contact Address columns where the Contact Type = _MailingAddress to the Mailing columns
    Copy COA contact address to Shipping Address and added "COA Pending" to Shipping2 column

    IF _MailingAddress IS listed as a Contact Type but COA is NOT listed as a Contact Type Then
    Copy the Contact Address columns where the Contact Type = _MailingAddress to the Mailing columns
    Copy the Regular Address to the Shipping Address columns - because this student does not have a Shipping Address as the contact type

    IF _MailingAddress in NOT listed as a Contact Type, but COA is listed as a Contact Type THEN
    Copy the COA Address to the Mailing & Shipping Address columns
    Add "COA Pending" to the end of the data within the Contact Address2

    If _MailingAddress is NOT listed and COA is NOT listed Then
    Copy Regular Address columns to MailingAddress and Shipping Address columns

    Do you want all rows to have the same new, copied values: i.e., if there are four entries, all entries get the new values in the appropriate columns? It will not be formula-driven, but macro (VBA code) - are you okay with enabling and using macros? (some organizations don't allow macro code....)
    Last edited by Bernie Deitrick; 06-02-2022 at 11:57 AM.

  5. #5
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Re: Combining multiple records, with unique value into one row

    Hi Bernie,

    I'm sorry about the mix up with the examples and Sample Data.

    Yes, the rules you have are correct, I will need to add the same rules for ShippingAddress, but I think I can handle that, once the code is written.

    I am comfortable with VBA Codes and macros, we have no restrictions with using them.

    Thanks so much for your assistance!

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Combining multiple records, with unique value into one row

    Try this initial macro, that handles just the first case, where _MailingAddress and COA are both listed:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Re: Combining multiple records, with unique value into one row

    Hi Bernie,

    I put this in my original spreadsheet and tweaked it to correspond with the columns and it worked!

    Awesome!!

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Combining multiple records, with unique value into one row

    Are you able to handle the other cases based on my example code or do you need help with that?

  9. #9
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Re: Combining multiple records, with unique value into one row

    I'll give it a shot and let you know if I need help or your eye on my code.

    Thanks for getting me started!

  10. #10
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Re: Combining multiple records, with unique value into one row

    I was able to make the necessary adjustments to my original spreadsheet. However, I discovered that it is looking at a change in the RegularAddress. It should be looking at a change in the Student ID (Column A). I have attached my sample spreadsheet and included a tab for the example conditions - if you can work with the first one, as well as the sample output.

    I have tried tweaking it, but it isn't working for me.


    Are there any ideas to make these conditions work?

    Thanks!
    Attached Files Attached Files
    Last edited by baby0bugs; 06-22-2022 at 09:52 AM. Reason: updates?

  11. #11
    Registered User
    Join Date
    05-31-2022
    Location
    Pennsylvania, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    [SOLVED] Re: Combining multiple records, with unique value into one row

    Figured it out myself - got it working.

+ 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] Count unique IDs that have multiple records
    By scubadiver007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-07-2021, 04:13 AM
  2. [SOLVED] Retrieving multiple records for each unique ID
    By iMiloDino in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-17-2016, 02:22 AM
  3. Replies: 4
    Last Post: 04-06-2016, 06:00 PM
  4. combining unique records with different column info from multiple sheets
    By BethaW in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2015, 03:08 PM
  5. Combining multiple records (based on name/co)
    By jeanpsu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2014, 07:54 AM
  6. Combining two tables to produce new table with unique records
    By thales in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-22-2012, 04:47 AM
  7. Replies: 4
    Last Post: 09-14-2009, 09:57 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