data validation

sjoerd.bosch

New Member
Joined
Feb 9, 2012
Messages
49
I need a data validation restriction for a cell
problem is that the cell in which I need the restriction contains a formula and I guess that is the reason why my data validation entry does not work.
For example: cell d4 / cell d5 = result in cell d6 The result in cell d6 should be not less than 12.0000 (decimals must be allowed)
A VBA code is also possible, but I thought this would be something simple in data validation
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I need a data validation restriction for a cell
problem is that the cell in which I need the restriction contains a formula and I guess that is the reason why my data validation entry does not work.
For example: cell d4 / cell d5 = result in cell d6 The result in cell d6 should be not less than 12.0000 (decimals must be allowed)
A VBA code is also possible, but I thought this would be something simple in data validation
You can only validate on cell input, but formula output.

If you're looking to cap the minimum, you can try
Excel Formula:
=MAX(12,D4/D5)

This will always give you the lowest value of 12.
 
Upvote 0
This is not working for me. Will try to explain more detailed
D4: 272 [is the input cell]
D5: 24 [is also an input cell]
D6: 11.3 [is the cell where the formula =D4/D5 is and which I need to restrict to MIN 12.0000]
If I enter the data validation in Cell D4 - =MIN(12,D4/D5) - it is not working
 
Upvote 0
This is not working for me. Will try to explain more detailed
D4: 272 [is the input cell]
D5: 24 [is also an input cell]
D6: 11.3 [is the cell where the formula =D4/D5 is and which I need to restrict to MIN 12.0000]
If I enter the data validation in Cell D4 - =MIN(12,D4/D5) - it is not working
In Cell D6, insert
Excel Formula:
=MAX(12,D4/D5)
 
Upvote 0
Inserted
In Cell D6, insert
Excel Formula:
=MAX(12,D4/D5)

You can only validate on cell input, but formula output.

If you're looking to cap the minimum, you can try
Excel Formula:
=MAX(12,D4/D5)

This will always give you the lowest value of 12.
I am not trying to cap the value - I just need a warning message to come up
other value must be allowed in special cases

So I would like cell D6 to display a message if the value is less than 12
and neither of the formulas work for me btw
 
Upvote 0
Another option is a worksheet change event. First, change your formula to:
VBA Code:
=IFERROR(D4/D5,0)
And put this code on the sheet code area of the sheet with the formula:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.CountLarge = 1 And Not Intersect(Range("D4:D5"), Target) Is Nothing Then
    On Error GoTo Escape
    Application.EnableEvents = False
        If Range("D6") < 12 Then
            MsgBox "Formula results in D5 less than 12 - please re-enter"
            Target.ClearContents
            Target.Select
        End If
    End If
Continue:
    Application.EnableEvents = True
    Exit Sub
Escape:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume Continue
End Sub
 
Upvote 0
apologies - the
Inserted



I am not trying to cap the value - I just need a warning message to come up
other value must be allowed in special cases

So I would like cell D6 to display a message if the value is less than 12
and neither of the formulas work for me btw
max formula does work, but not looking to max the value. Just a warning message from data validation
 
Upvote 0
apologies - the

max formula does work, but not looking to max the value. Just a warning message from data validation
How about
Excel Formula:
=IF(D4/D5<12, "The current value is " & D4/D5 & " which is less than 12", D4/D5)
 
Upvote 0
Yes, data validation will not work for cell with formula
But for warning purpose only, why not using conditioning formating in cell D6?
=D6<12

Capture.JPG
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top