+ Reply to Thread
Results 1 to 5 of 5

Data Validation with date format dd/mm/yyyy hh:mm and N/A

  1. #1
    Registered User
    Join Date
    04-02-2019
    Location
    uk
    MS-Off Ver
    2017
    Posts
    3

    Data Validation with date format dd/mm/yyyy hh:mm and N/A

    I can't find an example anywhere of the following and was hoping somebody could help solve this for me?

    I have a column (X3 is the first cell for entry) which I require the user to comply with entering a date time in the format dd/mm/yyyy hh:mm


    I also want to allow them a text option so they can enter N/A or similar if no date is required. I need this to distinguish from blanks so I can ascertain what hasn't been filled in yet.

    I've looked at an OR statement including a MOD trick I found to validate the date time, but including any reference to to the "N/A" is causing it to Red X upon entry.....

    So in the custom data validation formula i've tried

    =OR(MOD(X3,2),X3="N/A")


    Where am I going wrong?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Data Validation with date format dd/mm/yyyy hh:mm and N/A

    I don't understand how your MOD trick works. When I use it by itself it does not require that you enter a date. I can enter any number at all except an even number.

    The reason you get an error is if you enter text in the cell, then evaluate MOD against the text, it causes the formula to result in a #VALUE error.

    I would suggest this. This assumes that the date must be on or after Jan 1 2020. You can change to suit.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-02-2019
    Location
    uk
    MS-Off Ver
    2017
    Posts
    3

    Re: Data Validation with date format dd/mm/yyyy hh:mm and N/A

    Thanks for the solution. I picked up the MOD part of the formula from another forum where the validation solution required was to ensure that the full dd/mm/yyyy hh:mm was entered.

    Although I don't 100% understand why it works I believe the idea was to make sure a number with a decimal was entered which would then translate into the time portion of the time date integer.decimal

    I'm really looking to make sure the user inputs a full date time value instead of just a date. With the added option of noting an N/A if required
    Last edited by bbaseballtheory; 05-28-2020 at 06:33 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Data Validation with date format dd/mm/yyyy hh:mm and N/A

    I think you may have copied the MOD solution incorrectly. For what you described, you want this:

    MOD(X3,1)

    That expression returns 0 if the number is an integer, which will be interpreted as FALSE. A date without a time is an integer.



    Then the total solution is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The reason I added the check for the date is that with your original solution you could also enter 1.1, which is in the year 1900 and may not be a valid date for you. If you really don't care what the date is you can remove that part of the formula. In that case it is no longer necessary to check for ISNUMBER since IFERROR will cover that for the MOD function.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-02-2019
    Location
    uk
    MS-Off Ver
    2017
    Posts
    3

    Re: Data Validation with date format dd/mm/yyyy hh:mm and N/A

    This makes a lot more sense deconstructed and explained.

    Thanks for taking the time to get back to me. I will implement tomorrow and see if that fits the purpose. On the face of it, it looks 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. [SOLVED] set Data validation in input box to accept only date format mmm-yyyy
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2019, 09:49 AM
  2. Replies: 3
    Last Post: 04-25-2019, 11:05 AM
  3. Forcing date format (dd/mm/yyyy) using data validation
    By reddwarf in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-12-2018, 01:48 AM
  4. Convert Date format from Text format reading m/d/yyyy to dd/mm/yyyy
    By bridge4444 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-23-2017, 11:22 PM
  5. [SOLVED] Data Validation Issue with Date mm/dd/yyyy
    By Dimitrov in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2013, 06:34 PM
  6. Replies: 7
    Last Post: 11-18-2012, 02:28 PM
  7. [SOLVED] Imported data contains strings dd.mm.yyyy how can I convert to date format dd/mm/yyyy inVB
    By Boormo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-05-2012, 05:48 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