+ Reply to Thread
Results 1 to 5 of 5

Complex Stock Market IF AND function with time and date restriction

  1. #1
    Registered User
    Join Date
    01-21-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Complex Stock Market IF AND function with time and date restriction

    Hello,

    My goal is for the date and time to be live if the market is open, but appear as 4:00 PM and the last day the market was open if it is closed.

    Right now, it is set up in two cells independent of each other -- (1) date and (2) time

    I am working on a formula to display the date for a sheet with stock quotes and such. I am actually using a google spreadsheet with googlefinance commands. Since these do not update before 9:30 AM or after 4:00 PM, I am trying to find a formula to display the date for the actual day the quote is from.

    So the goal is to have an IF function that says if it is before 9:30 AM, please refer to yesterday
    But also IF it is Sunday or Monday, refer to Friday

    It would be nice if holidays could be excluded as well, but they are not necessary if it requires a reference for dates in a separate array of cells...

    =IF(NOW()-TODAY())<(9.5/24), TODAY()-1, IF(AND(WEEKDAY(TODAY()))=1, (NOW()-TODAY())<(9.5/24)), TODAY()-2, IF(AND(WEEKDAY(TODAY()))=2, (NOW()-TODAY())<(9.5/24)), TODAY()-3

    Above is what I have, but it gives #ERROR! and says parse error.

    --

    In a separate cell, I would like a time stamp.

    =IF((NOW()-TODAY())>(16/24) & (NOW()-TODAY())<(9.5/24), 16/24, NOW()-TODAY())

    The goal is for this cell to say to be 4:00 PM if it is not between 9:30 AM and 4:00 PM, but for it to read the actual time (NOW()-TODAY()) if the time is between 9:30 AM and 4:00 PM

    This displays a number buy does not stop at 4:00 PM like I want it to.

    I think I have the right idea, but there are some flaws in the formulas. Thank you for your help.

    Best,
    Matt
    Last edited by Matt_B; 01-21-2014 at 08:42 PM. Reason: Add Detail

  2. #2
    Registered User
    Join Date
    01-21-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Complex Stock Market IF AND function with time and date restriction

    bump .. thank you in advance

  3. #3
    Registered User
    Join Date
    01-21-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Complex Stock Market IF AND function with time and date restriction

    bump again, sorry this is getting buried

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Complex Stock Market IF AND function with time and date restriction

    Hello Matt,

    Try using WORKDAY function like this for the date

    =WORKDAY(NOW()+14.5/24,-1)

    by adding 14.5 hours to the current date/time that will put you in tomorrow if the time is currently 09:30 or later.....but still remain today if earlier, -1 then gives you the previous working day, which should work in all cases

    You can add a holiday range to the WORKDAY function if required

    for the time you need an OR function like this

    =IF(OR(NOW()-TODAY()>16/24,NOW()-TODAY()<9.5/24),16/24,NOW()-TODAY())
    Audere est facere

  5. #5
    Registered User
    Join Date
    01-21-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Complex Stock Market IF AND function with time and date restriction

    Thank You!!! perfect !

+ 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. Excel VBA Function: Rolling Period Compound Return
    By jwhitt74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2009, 12:50 AM
  2. Function to work out monthly compound rate
    By mattll in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2009, 02:37 AM
  3. How do I make a compound function?
    By Chris T-M in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-01-2006, 10:10 AM
  4. Applying FIND Function on a Compound word
    By sylink in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2005, 01:00 PM
  5. [SOLVED] Compound Rate Function
    By BL in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 09-06-2005, 03:05 AM

Tags for this Thread

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