+ Reply to Thread
Results 1 to 18 of 18

Ignore Number To Left of Decimal In Conditional Format

  1. #1
    Registered User
    Join Date
    01-13-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    4

    Ignore Number To Left of Decimal In Conditional Format

    Hello, I am working on an attendance spreadsheet and would like to highlight when someone has been late by 15 minutes. The problem is that the values stored are stored in this format "dddd-mmmm-dd-yyyy h:mm AM/PM" so that gives me a decimal number of 43833.29167 for friday at 7:00 AM. 15 minutes after that comes to 43833.30208. Is there a way for conditional formatting to ignore all the number to the left of the decimal point, IE XXXXX.30208. Any help on this would be appreciated.

    Thank You
    -Max

  2. #2
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    =mod(43833.30208;1) 0,30208

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Ignore Number To Left of Decimal In Conditional Format

    Hello and welcome to the forum.

    It would help for us to see a sample workbook that shows where the cells are for example.
    Also, how do we know what time each person is supposed to come in?

    The only advice that we can give without knowing this information is that =MOD(A1,1) where the full date/time is in A1 will return only the time.

    If you require additional help, consider uploading a sample workbook.

  4. #4
    Registered User
    Join Date
    01-13-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Ignore Number To Left of Decimal In Conditional Format

    It isn't accepting that equation. It says "Enter a valid formula"

  5. #5
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    May be ; should change to , . For my country separator is ;

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,663

    Re: Ignore Number To Left of Decimal In Conditional Format

    Calculating tardiness requires that you subtract the actual start/arrival time (in A2) from the scheduled start/arrival time (in A1). If those times are on the same day, they will always be less than 1 (>= 0.010417). So you calculate:
    Please Login or Register  to view this content.
    For True/False results
    Ben Van Johnson

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Ignore Number To Left of Decimal In Conditional Format

    Quote Originally Posted by BMV View Post
    =mod(43833.30208;1)
    Caveat: =MOD(DATE(2020,1,3)+TIME(9,15,0),1)>=TIME(9,15,0) returns FALSE(!), which is misleading if 9:15 is considered "late".

    The point is: MOD(date+time,1) does not always result in the correct binary representation of "time" alone.

    More reliable: --TEXT(date+time,"h:m")>=time

  8. #8
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    =(A2-$A$1)>=(15/1440) I would like see as =A2-$A$1-"00:15">=0 or =A2>=$A$1+"00:15" . The result is the same but it is more readable.

  9. #9
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    Quote Originally Posted by joeu2004 View Post
    The point is: MOD(date+time,1) does not always result in the correct binary representation of "time" alone.
    it's true. Unfortunately floating point standard we cant change :-)

  10. #10
    Registered User
    Join Date
    01-13-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Ignore Number To Left of Decimal In Conditional Format

    I have tried what you guys are telling me, but I am obviously doing something wrong, or my date format in the cells is whats messing everything up. I am trying to attach a sample of my workbook, but the site isn't letting me because i haven't posted enough. I will post a pic of my table, maybe that will help.

    thanks for all the help so far. i will keep at it.

    Capture.PNG
    Attached Files Attached Files

  11. #11
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Ignore Number To Left of Decimal In Conditional Format

    In your workbook from post #10, you want to highlight all of the times that are at least 15 minutes past the time in cell A1?

  12. #12
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Ignore Number To Left of Decimal In Conditional Format

    If the answer to post #11 is yes, try this:

    Highlight C2:C45 > Conditional Formatting > New Rule > Use a formula
    =MOD(C2,1)-TIME(0,15,0)>=A$1
    Format: Fill color of your choice > OK > OK

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,663

    Re: Ignore Number To Left of Decimal In Conditional Format

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Ignore Number To Left of Decimal In Conditional Format

    Quote Originally Posted by BMV View Post
    I would like see as =A2-$A$1-"00:15">=0 or =A2>=$A$1+"00:15" . The result is the same but it is more readable.
    Mathematically, yes.

    But again, not always in Excel for two possible reasons: (1) order sensitivity of binary arithmetic; and (2) tricks that Excel plays with comparison operators (">=") in this context.

    Again, suppose A1 is 1/3/2020 9:00 and A2 is 1/3/2020 9:15. (It does not matter whether you interpret the date as m/d/yyyy or d/m/yyyy.)

    =A2>=$A$1+"00:15" returns TRUE. But =A2-$A$1-"00:15">=0 returns FALSE(!).

    In that example, the difference is due to the order sensitivity of binary arithmetic. A work-around is =A2-($A$1+"00:15")>=0.

    But in theory, =A2>=$A$1+"00:15" might return a different result because when the left and right sides are non-zero, Excel rounds their binary values to 15 significant decimal digits for the purpose of the comparison.

    However, in practice, that does not seem to be a problem for this date/time arithmetic.

  15. #15
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    Quote Originally Posted by joeu2004 View Post
    Mathematically, yes.
    But again,
    First part is relevant for Text value of A2. The second - It is regular problem and the reason is not 15 digits but IEEE 754. Different could be even in 8. There fore for EQ comparing is better to round both value or round result if Round(A2-$A$1-"00:15";x)>=0 or...

  16. #16
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Ignore Number To Left of Decimal In Conditional Format

    Quote Originally Posted by joeu2004 View Post
    A work-around is =A2-($A$1+"00:15")>=0. But in theory, =A2>=$A$1+"00:15" might return a different result because when the left and right sides are non-zero, Excel rounds their binary values to 15 significant decimal digits for the purpose of the comparison.
    Quote Originally Posted by BMV View Post
    It is regular problem and the reason is not 15 digits but IEEE 754.
    I was referring to something that Excel does that departs from the IEEE 754 standard. Consider the following example:

    A1: 1234.56789012345
    A2: =A1 + 2E-12
    A3: =MATCH(A1,A2,0)
    A4: =A2=A1
    A5: =A2-A1=0

    A3 returns #N/A because MATCH compares the exact binary values, and A1 and A2 are indeed different binary values.

    And A5 returns FALSE, because in this context, Excel calculates exact binary difference, which is about 2.05E-12, and compares with zero.

    We might expect the comparison in A4 to have the same result, because A2=A1 is mathematically equivalent to A2-A1=0.

    But A4 returns TRUE(!), because for the compariso operators ("=", " <> ", " >= ", etc), Excel rounds A2 and A1 to 15 significant decimal digits for the purpose of the comparison.

    Note that both A2 and A1 display 1234.5678901234500 when formatted to display 17 significant digits, because Excel formats only the first 15 significant digits (rounded).

    (IEEE 754 requires conversion to and from 17 significant digits in order to convert between decimal and binary with no loss of precision.)


    Quote Originally Posted by BMV View Post
    for EQ comparing is better to round both value or round result if Round(A2-$A$1-"00:15";x)>=0
    You're preaching to the choir. That was the point that I made (by example) when I commented on your unrounded use of MOD(...,1).

    But for time arithmetic, I would not use ROUND(time,x).

    Instead, either I would use --TEXT(time,"h:m"), as I wrote earlier, or I would use --TEXT(ROUND(time*1440,0)/1440,"h:m"), although we can usually get away with ROUND(time*1440,0)/1440.

    The difference between the first two methods is how Excel rounds seconds.

    For example, --TEXT("12:34:56","h:m") returns 12:34 when formatted as Time; but ROUND("12:34:56"*1440,0)/1440 returns 12:35.

    (In the example Excel file that Max attached, date and times are accurate to the second, even though they are formatted to display only to the minute.)

    ----

    I'm afraid that we're getting a little off-topic. So, that will be my last comment in this thread about binary anomalies.
    Last edited by joeu2004; 01-14-2020 at 04:22 AM.

  17. #17
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Ignore Number To Left of Decimal In Conditional Format

    off
    joeu2004 it's clear for me and probably will useful for others. In spit of I novice here I have experience but for me is not easy to write and explain because of language skill.

  18. #18
    Registered User
    Join Date
    01-13-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Ignore Number To Left of Decimal In Conditional Format

    Thank you guys for helping me on this. 63falcondude, your formula kinda worked, but there were some times that were not getting highlighted when they should have been and others getting highlighted when they shouldn't have been, see pic below. protonLeah, your formula and setup did the trick, thank you!

    Capture.PNG

+ 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: 14
    Last Post: 09-03-2018, 01:45 PM
  2. How to conditional format a range but ignore zero values
    By deichburg in forum Excel General
    Replies: 3
    Last Post: 03-14-2018, 02:41 PM
  3. [SOLVED] Conditional format duplicates ignore certain criteria
    By spoursy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-31-2014, 07:49 AM
  4. Vba to format number of decimal places dependant on number in another cell
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 09:33 AM
  5. Display only the number from left of decimal point.
    By arthurz11 in forum Excel General
    Replies: 9
    Last Post: 10-29-2011, 03:20 AM
  6. Conditional Number Format for varying decimal places
    By justme23 in forum Excel General
    Replies: 3
    Last Post: 04-30-2010, 03:31 PM
  7. Formula to use number in cell to left & ignore any empty cells
    By joya in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2007, 12:52 PM

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