+ Reply to Thread
Results 1 to 3 of 3

macro or formula to combine duplicate records of a field by combining other field values

  1. #1
    Registered User
    Join Date
    03-18-2022
    Location
    delhi
    MS-Off Ver
    excel 2019
    Posts
    5

    macro or formula to combine duplicate records of a field by combining other field values

    If the field B (is item no contains both text, string) includes 'sample' anywhere in cell value, then there should only be one line in excel file per field A value (A is also alphanumerical).
    If there are duplicate values of field A, then would like to concatenate all values of field B using symbol | in a separate row.

    I have tried using the IF formula, but it does not work. Please advise on the macro/formula.



    Thanks
    Attached Files Attached Files
    Last edited by kriskris12; 03-23-2022 at 10:51 AM.

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

    Re: macro or formula to combine duplicate records of a field by combining other field valu

    Perhaps the following will help.
    1. To make a list of distinct PO numbers: =IFERROR(INDEX(A$2:A$30,MATCH(0,INDEX(COUNTIF(E$1:E1,A$2:A$30),,),)),"")
    2. To make concatenate items numbers associated with each PO**: =TEXTJOIN("|",TRUE,IF(A$2:A$30=E2,B$2:B$30,""))
    ** Denotes an array entered formula which is not entered in the same way as a 'standard' formula. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    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.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: macro or formula to combine duplicate records of a field by combining other field valu

    So...Combine...Only if duplicates have corresponding Item Numbers that contain the text "SAMPLE"
    Vba Solution...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

+ 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. How to create macro that adds value to cell and create save button.
    By Censored in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2019, 12:25 PM
  2. How to create a macro to create a pivot table on a new sheet
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:14 AM
  3. Create VBA Macro to create new rows according to data between Sheet1 and Sheet2
    By kcarth in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2015, 02:06 PM
  4. Create a macro to create a pivot table in a worksheet
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2015, 10:53 AM
  5. Macro to find a word in a cell, create a transparent text zone over it, create a hyperlink
    By martin brandl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2015, 03:24 PM
  6. Replies: 1
    Last Post: 07-23-2014, 04:33 AM
  7. Replies: 7
    Last Post: 05-17-2012, 03:08 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