+ Reply to Thread
Results 1 to 4 of 4

numeric value only , no dates input allowed

  1. #1
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    numeric value only , no dates input allowed

    I need to somehow have a whole numeric value in a cell (but not allow a date input). The numeric value can be anything from 0-6 digits long. (i.e. can i stop the following symbols being put in to prevent this . / - ?

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: numeric value only , no dates input allowed

    EDIT
    Ignore as it accepts the number as a date -
    you can use data validation so that only numbers can be entered
    https://www.techonthenet.com/excel/c...tion2_2010.php
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,391

    Re: numeric value only , no dates input allowed

    As etaf notes, simple "restrict entry to a number" won't work, because Excel sees dates as numbers. The only difference between a number and a date is the cell formatting.

    I tried using data validation using the CELL() function to return formatting information (https://support.office.com/en-us/art...f-955d67c2b2cf ).
    (Data Validation -> Settings -> Allow custom -> formula =LEFT(CELL("format"),1)<>"D"). This mostly worked, as long as the cell was preformatted as "General". When the cell is preformatted as "General" and a date and/or time entry is attempted, then Excel will automatically format the cell with an appropriate date format. If I had the cell preformatted as "0" ("F0" as the CELL() function saw it), then Excel would receive the date entry, convert it to the appropriate serial number, and enter that number into the cell without changing the format. So an entry of 1/13/16 would become 42382 (which fits very nicely within your 0 to 1E7 data entry range).

    I could also figuring out an approach that preformats the cell as text "@", so that Excel will not try to interpret any input. Then you can test the input in other ways. For example, I preformatted a cell as text "@", data validation -> settings -> allow custom -> formula =IFERROR(FIND("/",A1),-1)<0. This would allow anything to be entered in the cell except for something containing a "/". As long as you are certain that no one will ever try to use any other date format delimiter (eg. 1.13.16), then this should also catch the invalid entry.

    Not perfect solutions, but maybe they are workable or will provide a starting place for what you are trying to do.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Re: numeric value only , no dates input allowed

    I have tried this, and I it works for any date as you say with a " / " divider. So I will use that, its more of a case of a buffer in case its input wrongly, and wonder if you can expand the formula, but will experiment, but it does nicely as it is! Many thanks

    Quote Originally Posted by MrShorty View Post

    I could also figuring out an approach that preformats the cell as text "@", so that Excel will not try to interpret any input. Then you can test the input in other ways. For example, I preformatted a cell as text "@", data validation -> settings -> allow custom -> formula =IFERROR(FIND("/",A1),-1)<0. This would allow anything to be entered in the cell except for something containing a "/". As long as you are certain that no one will ever try to use any other date format delimiter (eg. 1.13.16), then this should also catch the invalid entry.

    Not perfect solutions, but maybe they are workable or will provide a starting place for what you are trying to do.

+ 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] Macro to limit number of allowed characters in a dialog input field
    By kappa0815 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-07-2016, 05:34 AM
  2. Limit input to ONLY Numeric input and not alpha characters
    By aresquare1 in forum Excel General
    Replies: 3
    Last Post: 08-25-2015, 09:38 AM
  3. [SOLVED] vba macros to force user to input numeric values for numeric values with hyphen
    By Abdur_rahman in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2013, 01:05 PM
  4. [SOLVED] Numeric Input Popup Box
    By ajam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2013, 06:51 PM
  5. Allow only a numeric value to be input into a cell
    By jartzh in forum Excel General
    Replies: 4
    Last Post: 05-07-2010, 11:28 AM
  6. Only Numeric Value in Input Box?
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2007, 05:24 PM
  7. [SOLVED] Format spreadsheet so no input allowed if certain cell is =<0
    By Jan Buckley in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-25-2005, 09:06 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