+ Reply to Thread
Results 1 to 5 of 5

data validation failed on time field

  1. #1
    Registered User
    Join Date
    08-24-2006
    Posts
    61

    data validation failed on time field

    i have a overtime sheet to calculate the time on regular / over time.

    how to tweak the formula to allow cross date input?

    currently when i input time which is 00:00, data validation prompted (i off data validation), then calc result is wrong with negative value.

    i want to allow user to input from 09:00 to 01:30 (next day) then calc still working.
    Last edited by only_lonely; 12-11-2018 at 05:38 AM.

  2. #2
    Registered User
    Join Date
    08-24-2006
    Posts
    61

    Re: data validation failed on time field

    attached the file.

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: data validation failed on time field

    try below formula in data validation
    =AND($E12<=1,ISNUMBER($E12),OR($E12>=$D12,$E12<=TIME(1,30,0)))
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Registered User
    Join Date
    08-24-2006
    Posts
    61
    Quote Originally Posted by samba_ravi View Post
    try below formula in data validation
    =AND($E12<=1,ISNUMBER($E12),OR($E12>=$D12,$E12<=TIME(1,30,0)))
    Thanks. Data validation working now.
    But the regulars and OT hours calculation is wrong.
    Example
    09:30 in time
    00:30 out time
    1hr break
    Regular hours become -11.0
    OT hours is 0
    Regular hours should be 10
    OT hours should be 15 - 1 - 10 = 4

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,648

    Re: data validation failed on time field

    See if the following does what you want:
    1) For the regular hours (G12): =IF(AND(D12<>"",E12<>""),MIN(D$8,(E12+(D12>E12)-D12-F12/24)*24),"")
    2) For the overtime hours (H12): =IF(AND(D12<>"",E12<>""),MAX(0,(E12+(D12>E12)-D12-F12/24-G12/24)*24),"")
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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 on a field with data validation
    By rainhamresident in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2014, 02:16 PM
  2. Replies: 10
    Last Post: 08-15-2012, 10:20 AM
  3. Using Data Validation to query a field?
    By Cyberpawz in forum Excel General
    Replies: 3
    Last Post: 04-12-2012, 12:11 PM
  4. VBA for data validation --> Method 'Add' of object 'Validation' failed
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2010, 06:18 AM
  5. [SOLVED] Field Data Validation in VBA Forms - Here's a way
    By Greg Glynn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2006, 12:00 AM
  6. Replies: 1
    Last Post: 03-14-2006, 10:25 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