Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I would like to validate cells to limit input to only 2 decimals. If the
user inputs a value with 2 decimals, I want to system to return an error message. Is there a way to do this without the use of VB? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi try this solution given some time ago in the community
Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the window that appears. I have assumed that you want to do checking only on single cell entries. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Target.Value = "" Then Exit Sub Application.EnableEvents = False If Target.Value < Round(Target.Value, 2) Then Target.Value = "" MsgBox "Bad value. Bad, bad, value. Rejected!!!!" End If Application.EnableEvents = True End Sub "MauraC" wrote: I would like to validate cells to limit input to only 2 decimals. If the user inputs a value with 2 decimals, I want to system to return an error message. Is there a way to do this without the use of VB? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
MauraC wrote:
I would like to validate cells to limit input to only 2 decimals. If the user inputs a value with 2 decimals, I want to system to return an error message. Is there a way to do this without the use of VB? Data validation: =A1*100=(INT(A1*100)) |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Data validation:
=NOT(MOD(100*A1,1)) Regards, Bernd |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Bernd P wrote:
Data validation: =NOT(MOD(100*A1,1)) Regards, Bernd Yes! Although as an afterthought, I would use this, which makes the number of decimal places more obvious: =NOT(MOD(10^2*A1,1)) |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
"Bernd P" wrote:
Data validation: =NOT(MOD(100*A1,1)) I believe that has a limit of 1342177.27. Why not simply: =TRUNC(A1,2)=A1 |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
PS....
I wrote: "Bernd P" wrote: =NOT(MOD(100*A1,1)) I believe that has a limit of 1342177.27. Perhaps I need to say "in Excel 2003". I don't know about Excel 2007. Then again, the OP did not identify the Excel version she is working with. ----- original message ----- "JoeU2004" wrote in message ... "Bernd P" wrote: Data validation: =NOT(MOD(100*A1,1)) I believe that has a limit of 1342177.27. Why not simply: =TRUNC(A1,2)=A1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set automatic currancy decimal without entering the decimal? | Excel Worksheet Functions | |||
Subtracting two 2-decimal place numbers gives result 13-decimal places? | Excel Worksheet Functions | |||
Batch converting CSV files from comma-decimal to period-decimal | Excel Discussion (Misc queries) | |||
Converting 2-place decimal value to floating point decimal number with leading zero | Excel Discussion (Misc queries) | |||
FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT. | Excel Discussion (Misc queries) |