+ Reply to Thread
Results 1 to 5 of 5

Calculating dates based on cell conents

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Calculating dates based on cell conents

    For the life of me, I can't figure this out. The scenario I am trying to calculate is as follows:

    I want write a formula that I can insert into O17:O102 that will check if B17:B102 contains either "*HS*","*GRND*","*MAC*", or "*LDDR*" and then propagate a date in O17:O102 that calculates a due date based on a date entered in F7 being, either 1 or 2 years based on the contents i.e. HS and LDDR is 2 years and GRND and MAC is 1 year.

    Could/Should this be done with VBA?

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Calculating dates based on cell conents

    I would say if you are calculating it from today and you don't want to hard code that into a cell to use in a formula, then yes you probably want to use VBA to put a value that's not going to change into a cell. Hopefully this is what you mean. If you could post a worksheet with some sample data and show the desired outcome I could be clearer.

    So with the worksheet below, I'm saying if you don't like these options and just want a number put into a cell based on using the windows date and being done with it, then VBA.
    Attached Files Attached Files
    Last edited by skywriter; 02-23-2015 at 03:04 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Calculating dates based on cell conents

    Try
    =IF(SUM(COUNTIFS(O17,"*"&{"HS","LDDR"}&"*")),EDATE($F$7,24),IF(SUM(COUNTIFS(O17,"*"&{"GRND","MAC"}&"*")),EDATE($F$7,12),""))


    Quote Originally Posted by nwb View Post
    Could/Should this be done with VBA?
    Generally speaking (there are exceptions to every rule)
    If it CAN be done without VBA, then it probably SHOULD be done without VBA.

    IMHO

  4. #4
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Calculating dates based on cell conents

    Jonmo1 -

    Your solution works perfectly! Thank you so much for you help!

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Calculating dates based on cell conents

    You're welcome.

+ 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] Calculating a future dates based on dates or birth.
    By CDobby in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-31-2012, 11:22 AM
  2. [SOLVED] Setting a cell based on the conents of another
    By zaach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2012, 11:31 AM
  3. Replies: 5
    Last Post: 06-11-2012, 01:00 AM
  4. Inserting space in between the conents in a cell
    By bengaluru in forum Excel General
    Replies: 2
    Last Post: 02-23-2011, 12:46 PM
  5. Calculating dates based on a particular cell
    By graemekoz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-22-2007, 07:22 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