+ Reply to Thread
Results 1 to 7 of 7

Clear contents based on contents of another cell

  1. #1
    Registered User
    Join Date
    04-12-2013
    Location
    Detroit
    MS-Off Ver
    Excel 2010
    Posts
    3

    Clear contents based on contents of another cell

    I've searched the board and found solutions to similar issues, but nothing that addresses the problem I'm working on. I'm using Excel 2010.

    Column H contains an opening date. Column I contains ages calculated via formula (e.g., I4 contains "=TODAY()-H3"). Column J may or may not contain a date. If Column J contains a date, Column L should display a closure age calculated by subtracting the date in Column H from the date in Column J.

    I need a macro that generates the following results, and I'm coming up dry:

    If the cell Column J is empty, the cell in Column I should display an age and the cell column L should be empty. If a date is entered into the cell in Column J, the cell in Column I should be empty and the cell in Column L should display a closure age. I need this to apply to all cells in these columns between Row 3 and Row Infinity.

    Thank you for your assistance; this is my first dive into VBA and macros.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Clear contents based on contents of another cell

    You should be able to do this with a formula. Something like this in column L =IF(J3="","",whatever your formula or value is). Column I =IF(J3="", whatever the formula or value, "")

    Then fill down

  3. #3
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,160

    Re: Clear contents based on contents of another cell

    Why dont you directly put formulae into the cells? Why do you need a macro for this?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    04-12-2013
    Location
    Detroit
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Clear contents based on contents of another cell

    If it's the case the formulae are the more efficient solution, then I'm having difficulty finding the correct formulae and formatting them properly.

  5. #5
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,137

    Re: Clear contents based on contents of another cell

    Hi

    Try this
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-12-2013
    Location
    Detroit
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Clear contents based on contents of another cell

    Quote Originally Posted by mehmetcik View Post
    Hi

    Try this
    That was incredibly helpful and exactly what I needed. Thank you!

  7. #7
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,160

    Re: Clear contents based on contents of another cell

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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