+ Reply to Thread
Results 1 to 2 of 2

IIF GetDate Function Not Working

  1. #1
    Registered User
    Join Date
    11-14-2011
    Location
    NEW YORK
    MS-Off Ver
    Excel 2007
    Posts
    6

    IIF GetDate Function Not Working

    Hi, I am using MS query (in Excel) as my platform. I am trying to create an expression that would say "(if the hour now is after 6AM, then do "A", otherwise do "B" )".
    Here is what I cam up with this far:
    datepart(hour,getdate()) '(would result in the current hour)'

    I tried to modify this a bit:
    IIF(datepart(hour,getdate())>6,"A","B")

    However, I am getting the following error message:
    "Incorrect Syntax near '>'. Statement(s) could not be prepared."

    Does anyone have an idea how to fix this?

    Thank you very much!

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: IIF GetDate Function Not Working

    How about,
    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

+ 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. IF statement not working with text function and edate function.
    By joshnathan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-04-2013, 10:26 AM
  2. [SOLVED] Using the Split function with another function incorporated is not working correctly
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 03:51 PM
  3. MATCH function within INDIRECT function not working
    By mgerada in forum Excel General
    Replies: 2
    Last Post: 09-04-2011, 08:37 AM
  4. Replies: 4
    Last Post: 12-21-2010, 04:34 PM
  5. Working with Arrays, pasing from function to function
    By mikebres in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2006, 01:40 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