+ Reply to Thread
Results 1 to 7 of 7

Data Validation Query: Restrict the data input to two decimal places

  1. #1
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2021
    Posts
    1,013

    Data Validation Query: Restrict the data input to two decimal places

    Hi,

    Is it possible to add a data validation to a cell which restricts the user from inputting more than 2 decimal places? I would have thought it would be easy to do but i'm struggling?!?!

    Cheers,

    Snook
    Last edited by The_Snook; 12-01-2012 at 05:58 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Data Validation Query: Restrict the data input to two decimal places

    it seems you cant restrict the number of decimal places with DV. what you could do to overcome this is to reference that cell with a rounddown() or roundup()
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Data Validation Query: Restrict the data input to two decimal places

    Try this in custom data validation

    Please Login or Register  to view this content.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2021
    Posts
    1,013

    Re: Data Validation Query: Restrict the data input to two decimal places

    I think you've cracked it Ace_XL Now i've just got to try and get my head around how it works!

    FDibbins - Thanks for your suggestion it got me thinking in a different way to a similar problem I had which i've now managed to solve using the ROUND formula.

    Rep points all round

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Data Validation Query: Restrict the data input to two decimal places

    we are happy to help, and thanks for the rep

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Data Validation Query: Restrict the data input to two decimal places

    Thanks for the rep

    Here is how it works..

    In case of a number without decimal points, it allows for any characters
    =IF(ISERROR(FIND(".",A1)),LEN(A1)>0

    in case it finds a decimal point (the FIND function) the <3 ensures that the number of decimals are less than or equal to 2

    One flaw with this would be that it would allow even non-numeric input. Hence a refined verison is as below

    Please Login or Register  to view this content.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Data Validation Query: Restrict the data input to two decimal places

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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