+ Reply to Thread
Results 1 to 14 of 14

Macro to display values in Col E only once if values of Col A, B, C, D, E and I are same

  1. #1
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Macro to display values in Col E only once if values of Col A, B, C, D, E and I are same

    Hello All,

    I am using Office 2013 and I need help with VBA for the problem shown in the attached sample file.

    Data starts from Row 2 till down. I have shown a small set only.

    The last Column is Col O

    If the Value in Col A, B, C, D, E and I are same then the values in Col E must be shown only once

    I have shown the result expected below in Rows 20 onwards.
    In the sample I have highlighted Row 4 & 5 also Rows 8, 9 and 10 for explanation.

    Values in Col E are shown only once

    Hope to get some help
    TIA
    Attached Files Attached Files
    Last edited by pnasir; 10-21-2020 at 02:28 PM.

  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: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Are the rows that are the same always adjacent or might they be separated?
    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
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    One way:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Dear Richard,
    Thanks for your reply. They will always be adjacent

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    And the solution offered in post #3?

  6. #6
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Dear Trevor,
    Thanks for your code. I tested your code on my actual data.
    My apologies for not showing few blanks cells in Column D in the sample submitted.
    It is also replacing cells with 0 under Column E if some adjacent cells are blank in Column D
    Also the code should run on Active Sheet and not on Sheet1

    Sorry once again.
    Thanks for your time and help

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    What does blanks in column D have to do with anything?

    Post an updated sample with revised expected results.

  8. #8
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Dear Trevor,
    I am attaching Revised Sample herewith.
    Please check Rows 6,7 & 12,13.
    In the submitted sample (old) there are values under Column E which is getting replaced by the macro.

    I think it is clear now.
    Thanks for your time and help.
    Attached Files Attached Files

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    OK, try with this version:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Hi Trevor,
    I will test it with my latest data when the office opens on Monday.
    I will get back to you.
    Thanks once again for your time and help

  11. #11
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Hello Trevor,
    I tested it with my actual data and I would request you to amend your code to look for duplicate values in Col C and change the value to zero for the second and subsequent rows under Col E.

    Thanks once again for all your time and help.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    I don't understand. Are you saying, check for duplicate values in ONLY column C, as opposed to duplicates in columns A, B, C, D and E?

    If that's the case, just remove the references to the other columns ( A, B, D and E ).

  13. #13
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    Hello Trevor,
    Sorry for getting back late due to some unavoidable circumstances.
    The macro works great.
    Post marked SOLVED. Rep added.
    Thanks for all your time and help.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to display values in Col E only once if values of Col A, B, C, D, E and I are sa

    You're welcome. Thanks for the rep.

+ 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. Using pivot table values (to display times and other values)
    By rayted in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-01-2018, 08:21 AM
  2. Replies: 1
    Last Post: 12-19-2017, 01:26 PM
  3. [SOLVED] compare values from 2 columns and display the unique values in other column
    By smatbis in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-20-2017, 09:58 AM
  4. Display and Return different values - Drop Down MACRO
    By bmt85 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-12-2016, 01:03 PM
  5. Find and display (go to) exact values (Macro)
    By Soilwork in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2014, 03:43 PM
  6. Replies: 3
    Last Post: 09-10-2014, 09:39 PM
  7. Replies: 1
    Last Post: 04-02-2005, 01:06 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