Consulting

Results 1 to 10 of 10

Thread: Solved: Quarter Hours?

  1. #1
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location

    Solved: Quarter Hours?

    Hi everyone,

    I would like to setup some conditional format to highlight if a TIME entered is on the quarter hour (i.e. 12:15pm, 12:30pm, 12:45pm, 1:00pm, etc.).

    I was thinking I could use MOD but time is really just a decimal, so how would you do something like this?
    Office 2010, Windows 7
    goal: to learn the most efficient way

  2. #2
    VBAX Contributor
    Joined
    Aug 2006
    Location
    Hampshire, UK
    Posts
    140
    Location
    Hi

    You could use a conditional formatting formula of:

    =MOD(A1*24,0.25)=0

    Assuming the time was in A1.

    Richard

  3. #3
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Perfect!

    Thanks Richard.
    Office 2010, Windows 7
    goal: to learn the most efficient way

  4. #4
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    actually, it's not fully working for some reason. I'm getting odd results (not 0) on some of my rows. I tried to post a screenshot but when I try to paste the code from HTMLmaker it shows up as CODE, not the worksheet.

    [edit] -- I changed the formula to highlight if it's NOT a quarter hour
    =MOD($C2*24,0.25)<>0
    Office 2010, Windows 7
    goal: to learn the most efficient way

  5. #5
    VBAX Contributor
    Joined
    Aug 2006
    Location
    Hampshire, UK
    Posts
    140
    Location
    Ok can you describe what these cells contain that are returning odd results? Are they hardcoded values or do they contain a formula? If so, what is the formula?

    It would be useful to actually write the formula that I provided in a worksheet cell, so that you can examine all the calculation steps to determine why the unexpected result is being returned.

    Richard

  6. #6
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Trying to attach an image of what i'm getting. In the image below, I would expect only rows 9, 10 and 12 to be highlighted.
    Office 2010, Windows 7
    goal: to learn the most efficient way

  7. #7
    VBAX Contributor
    Joined
    Aug 2006
    Location
    Hampshire, UK
    Posts
    140
    Location
    What are the times being generated from? Are they exact times or is there maybe a second component that is obscured by formatting? You could attach a small sample of your workbook - I think that would make things a bit easier for me/others to debug.

    Richard

  8. #8
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    ok hope this attachment works...
    Office 2010, Windows 7
    goal: to learn the most efficient way

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this formula

    =MOD(MINUTE(C2),15)=0
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Hey, it worked.
    Thanks guys.
    Office 2010, Windows 7
    goal: to learn the most efficient way

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •