+ Reply to Thread
Results 1 to 24 of 24

How to Make Cell Values Blank When Another Dependent Field is Duplicate

  1. #1
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Question How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Hello fellows,

    Looking for some help in deciphering the problem below. I've also included a file to point out the issue:

    I have the initial data set in columns A and B (sample). I need a way to take column B into the final state scenario which should be the same as column H based on the hierarchy/priority table in columns D and E.

    --

    Further info:

    Column A has duplicates. For each duplicate Fruit, I need to return only one value in the color section based on the table hierarchy so that it ends up like column H. Another potential issue may be that for Apples for example, there are two "Red" denominated for which in the final state, one must read "Red" and the next must read blank.

    Best,
    Attached Files Attached Files

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Hi dts10

    Welcome to the Forum...

    Not mentioned...but if your initial data is always going to be in order of color ranking then this works...
    Please Login or Register  to view this content.
    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!!!

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Hi dts,

    Try this:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Wow this works perfectly! Thanks.

    Could you please provide me with how I should modify to fit my spreadsheet? The duplicate values are in cell C and the values I need filtered are in Column J. The Reference table is in N and O.

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Provide a sample of your actual file setup scenario so that we may try and assist...

  6. #6
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Please find attached.
    Attached Files Attached Files

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    As per post 2...
    Not mentioned...but if your initial data is always going to be in order of color ranking then this works...
    None of the above code works for your actual file setup...In future it is advisable always to upload a sample depicting your actual scenario...
    Back to drawing board...

    Edit...Not much time left...will have a look at it in the morning...
    Last edited by sintek; 03-12-2019 at 03:24 PM.

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    I am slightly confused...According to your values in your data...
    Apples & Oranges Priority is = Red
    Pears & Watermelon Priority is = Orange

    I don't get your Result...Why is Pears Blue if there is a corresponding value of Orange...
    How is it that the Result table is sorted...Initially rows 2 & 3 were Orange...Why now are they red...

    Perhaps I am missing something...

    See attached Sintek result...Perhaps someone else can simply...
    Attached Files Attached Files
    Last edited by sintek; 03-12-2019 at 04:44 PM.

  9. #9
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Hi Sintek - you are right. You got the right values! I hadn't realized there was an "Orange" value.

    I'm trying to use the macro you implemented but getting a bud. Any idea why?

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    See Post 8...New sample file...
    Please Login or Register  to view this content.
    Last edited by sintek; 03-12-2019 at 04:46 PM.

  11. #11
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Works perfect in the example you provided! For some reason, I am getting the attached error message (Type Mismatch).

    The only thing different between the file I gave you as an example and the real file I need to modify is that the real file is 15000 records vs the sample had only 100.

    Any ideas?

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    I am making use of Column P as a helper column...Has your initial file got values in column P...Can only assume it is the size of the array...
    Last edited by sintek; 03-12-2019 at 11:34 PM.

  13. #13
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    No, values in column P.

    Values go from column A to column L.

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Is your content of a sensitive nature...Any chance you can desensitize and upload...
    Assuming the array only has 1 value...
    Last edited by sintek; 03-13-2019 at 12:01 AM.

  15. #15
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    This is the best I can do. It has the exact format I am using. The only important content columns as mentioned before are C and H. Thank you so much for the help.
    Attached Files Attached Files

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    You must have changed something as the error you previously mentioned did not come up...Run-time error '1004': AutoFilter method of range class failed was new error...

    Your reference table setup was different to initial file...Column J was hidden, no value in header row hence cells(1)current region code not working...

    Changed reference table back to initial setup...Inserted a header in Col J...

    Made use of Column M as helper instead of Col K...

    This solves...
    Attached Files Attached Files
    Last edited by sintek; 03-13-2019 at 10:49 AM.

  17. #17
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Getting the same error: For i = 2 To UBound(Val)

    I realized the second tab (reference table) that you sent in the new file is different than the one I provided in post 15 (may have something to do with this?).

  18. #18
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Could also be the following. In my Workbook. The 'Step 4 Errors' sheet is tab #4 and the 'Reference Table' sheet is tab #6. All of the other sheets 1-3 and 5 are irrelevant.

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Does the file in post 16 work for you...

    'Reference Table' sheet is tab #6
    Yes this does effect...
    Please Login or Register  to view this content.
    You need to understand the importance of exact setup...

    Code is written to the specifics and cannot accomodate changes that you might make or not incorporate in sample uploads...
    Last edited by sintek; 03-13-2019 at 12:51 PM.

  20. #20
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Tried changing sheets and it seems like the execution progressed to: Cells(1).CurrentRegion.AutoFilter 13, ">" & mn. There it hit an error: Runtime error 1004, Auto Filter on Range Class failed.

  21. #21
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    See above. Still running into this error when executing.

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    I cannot assist further unless you are more forethcoming with your file...Can go around in circles forever...So far all the code provided works for your uploads provided...Only reason it will not work is if your actual file scenario is different...

  23. #23
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    16.23
    Posts
    12

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    Sintek - this is the format of the file. Please see. The Step4_Errors and Reference table have exact format of the sheets/workbook. The other sheets are placeholders (for this exercise we do not use these tabs).
    Attached Files Attached Files

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

    Re: How to Make Cell Values Blank When Another Dependent Field is Duplicate

    This works....
    Attached Files Attached Files

+ 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] Remove duplicate values in Field cell from same column
    By nironto in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2016, 01:40 AM
  2. [HELP] me to remove duplicate values and leave that cell as blank
    By spa3212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2015, 01:23 PM
  3. [HELP] me to remove duplicate values and leave that cell as blank
    By spa3212 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-30-2015, 12:55 AM
  4. Make a cell value dependent on another cell's values,
    By matash in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-13-2015, 08:08 AM
  5. Replies: 1
    Last Post: 05-21-2014, 08:11 AM
  6. Replies: 1
    Last Post: 06-01-2013, 01:27 AM
  7. Duplicate data from field above if cell is blank
    By ollierice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2011, 05:16 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