+ Reply to Thread
Results 1 to 10 of 10

If a column contains a duplicate, then fill another column with the value.

  1. #1
    Registered User
    Join Date
    11-06-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    If a column contains a duplicate, then fill another column with the value.

    Hi,

    Currently I'm manually adding data from a sales figure list into our annual testing log which can take hours.

    I'm wondering if there is a macro or something that would help me do it?

    What I need to do is, when column C "part code" contains a duplicate then Column V to AG "Months" copies the value into the empty duplicate cell above.
    Sales Figures.JPG


    Hopefully this makes some sense and the attachment worked?

    Kind Regards
    David
    Last edited by david.gray; 11-07-2017 at 05:28 AM. Reason: Solved

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: If a column contains a duplicate, then fill another column with the value.

    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 solution is 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.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    11-06-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: If a column contains a duplicate, then fill another column with the value.

    Hi, Thanks for your reply.

    I have attached a small version of our excel sheet.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: If a column contains a duplicate, then fill another column with the value.

    Sorry - I can't see what is clearly obvious to you. What should be appearing based on your request and where?

  5. #5
    Registered User
    Join Date
    11-06-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: If a column contains a duplicate, then fill another column with the value.

    Currently we run a report which pulls the sales figures for that month, We then copy that into this excel sheet.

    So more often than not we have already added this part from a previous months figures.

    What I would like to do if its possible, is that if column C "Syspro Code"contains a duplicate then the monthly sales figure get copied into the blank cell above, if the cell above has the same duplicate syspro code of column C.

    My apologies if this doesn't make sense

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: If a column contains a duplicate, then fill another column with the value.

    Just give us a manually mocked up version of what you want with the manually mocked up cells highlighted in yellow - it will be so much easier than trying to visualise what you mean.

  7. #7
    Registered User
    Join Date
    11-06-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: If a column contains a duplicate, then fill another column with the value.

    Ok, last try to attempt to make some sense.

    Thanks Dave

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: If a column contains a duplicate, then fill another column with the value.

    Where is the yellow value coming from? How many rows could potentially be duplicated?

  9. #9
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: If a column contains a duplicate, then fill another column with the value.

    welcome to the forum. i suggest you do an example like how i did below. i did a Before and an After. you may read more about good samples in my signature link.

    i am guessing you want to move the value up and remove the value in the row it was duplicated. so maybe:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Attached Files Attached Files

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  10. #10
    Registered User
    Join Date
    11-06-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: If a column contains a duplicate, then fill another column with the value.

    Thank you so much, that does exactly what I need.

+ 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. Delete Duplicate rows with duplicate in 1 column based on value from another column
    By CraigR&M in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2016, 04:36 PM
  2. Delete Duplicate rows with duplicate in 1 column based on value from another column
    By CraigR&M in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2016, 02:06 PM
  3. Replies: 5
    Last Post: 02-18-2016, 12:51 PM
  4. Replies: 8
    Last Post: 06-25-2015, 08:59 AM
  5. Replies: 1
    Last Post: 06-01-2013, 01:27 AM
  6. Replies: 2
    Last Post: 03-09-2013, 10:14 PM
  7. Insert column and fill column upto where data is in previous column
    By aka189 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2012, 06:07 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