+ Reply to Thread
Results 1 to 8 of 8

replace duplicate excel by zero

  1. #1
    Registered User
    Join Date
    01-01-2021
    Location
    Morocco
    MS-Off Ver
    2018
    Posts
    31

    replace duplicate excel by zero

    Dear admins dear all I ask you to help me to realize a VBA macro that searches in column A on the duplicates that have the same values on column B the objective is to replace the duplicate values by zero as given in column C.
    please find in attachments the details
    thank you in advance
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: replace duplicate excel by zero

    Hi,

    This is clearly a much simplified example and probably doesn't represent the size of your actual data. We often find that when we give an answer to what is a trivial non representative example when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned.

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see. Clearly identify which is original data and which are the results and in a note clearly explain how you have arrived at your results.

    In this example it's not at all clear why C15:C16 are different to C3:C4. The y and k values are conceptually the same but the required results are different.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-01-2021
    Location
    Morocco
    MS-Off Ver
    2018
    Posts
    31

    Re: replace duplicate excel by zero

    thank you dear richard for your answer I just tried to simplify the data please find in attachments my exact data

    thank you
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-08-2008
    Location
    New York City
    MS-Off Ver
    2013-2016
    Posts
    157

    Re: replace duplicate excel by zero

    Hi YOUSSEFam,

    No need for VBA. Just a simple formula. If you add more items, change the formula to include the total number of rows.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    07-08-2008
    Location
    New York City
    MS-Off Ver
    2013-2016
    Posts
    157

    Re: replace duplicate excel by zero

    Sorry, on the previous formula I wasn't taking into account the values on column A. Here's the corrected one.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-01-2021
    Location
    Morocco
    MS-Off Ver
    2018
    Posts
    31

    Re: replace duplicate excel by zero

    thank you dear for your help it works well but i'm worth working this with a vba macro by clicking on a button if you have a solution to do it

    thank you

  7. #7
    Forum Contributor
    Join Date
    07-08-2008
    Location
    New York City
    MS-Off Ver
    2013-2016
    Posts
    157

    Re: replace duplicate excel by zero

    Here's one that works using a macro. It still uses the formulas on the cell but they are triggered by double-clicking the word MACRO on the column's title.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-01-2021
    Location
    Morocco
    MS-Off Ver
    2018
    Posts
    31
    Thanks dear it is work

+ 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 replace duplicate values with zero
    By YOUSSEFam in forum Excel General
    Replies: 2
    Last Post: 01-07-2021, 05:46 PM
  2. Replies: 1
    Last Post: 05-26-2020, 02:08 PM
  3. Replace duplicate cells
    By qiyusi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-05-2018, 01:38 AM
  4. [SOLVED] Duplicate List & Replace Placeholders
    By seethesun in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-24-2017, 02:50 PM
  5. VBA To Replace Consecutive Duplicate Values
    By Jamsandwich in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2015, 05:22 AM
  6. Replies: 1
    Last Post: 01-26-2012, 10:06 AM
  7. Replace duplicate with latest Date
    By dntel123 in forum Excel General
    Replies: 5
    Last Post: 11-30-2010, 01:36 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