+ Reply to Thread
Results 1 to 4 of 4

Need help with a if(and formula with today() please!

  1. #1
    Registered User
    Join Date
    01-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    83

    Need help with a if(and formula with today() please!

    Here what I have so far and it works but it gives me an error message and I can't easily add new rows. I'm thinking a small fix will do it.

    B c d e f
    date #1 date #2 =today() =if(and(D2>=B2,D2<=C2), "east coast", "west coast") =if(and((D2+30)>=B2,(D2+30)<=C2), "east coast", "west coast")


    and it continues adding 30 days out to a year where it basically shows a calendar projection of if my people are going to be on the west coast or the east coast.
    but it isn't working quite right. Any ideas?
    Last edited by seannormand; 10-24-2013 at 04:27 PM.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need help with a if(and formula with today() please!

    You could use a dynamic that applies to all formulas, instead of manually rewriting it each time:

    In E2:
    =IF(AND($D2+(30*(COLUMN(A1)-1))>=$B2,$D2+(30*(COLUMN(A1)-1))<=$C2), "east coast", "west coast")

    And then copy right across columns

    This will translate to =if(and(D2+0>=B2,D2+0<=C2), "east coast", "west coast") in E2, and =if(and(D2+30>=B2,D2+30<=C2), "east coast", "west coast") in F2, incrementing naturally by 30 per cell.

    But that only really gives a rough guesstimate on calendar months, so instead we take it one step further using DATE to apply exactly 1 month in advance instead of 30 days (some months are longer than others)

    This is your final formula for E2:
    =IF(AND(DATE(YEAR($D2),MONTH($D2)+COLUMN(A1)-1,DAY($D2))>=$B2,DATE(YEAR($D2),MONTH($D2)+COLUMN(A1)-1,DAY($D2))<=$C2), "east coast", "west coast")

    This will add accurate months, while using the absolute column references indicated by the $ signs. Now you can copy over as far as needed.


    calendar projection for seannormand.xlsx
    Last edited by daffodil11; 10-24-2013 at 06:38 PM.

  3. #3
    Registered User
    Join Date
    01-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Need help with a if(and formula with today() please!

    That worked great! Thanks! Any idea why it's still giving me "error" signs? It's functioning fine though. I appreciate the help!

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need help with a if(and formula with today() please!

    Which cells are giving error signs?

    It could the the relative references in your formula. References with $ in them do not move.

+ 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. Replies: 10
    Last Post: 09-06-2023, 08:19 PM
  2. [SOLVED] Counting Tasks With Due Dates between TODAY and TODAY+7
    By Erik_with_a_K in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-29-2013, 09:00 AM
  3. Replace today() with a hardcoded value representing today in all tabs
    By Romanian37 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2013, 07:03 AM
  4. Using TODAY in the formula
    By rgirardi in forum Excel General
    Replies: 2
    Last Post: 08-19-2011, 09:51 AM
  5. Replies: 3
    Last Post: 12-11-2007, 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