Data validation x2

The Grim Discovery

Board Regular
Joined
Jan 23, 2015
Messages
241
Office Version
  1. 365
Platform
  1. Windows
People, please help

Cells A1:A5 have data validation allowing a drop down selection of one of: 'yes', 'no' and 'not sure'.
This works fine.

But I need to add in an extra validation in cell A5 whereby if the selection in A4 is either 'No', or 'not sure', then no entry can be made into cell A5. I don't want people to be able to select an answer or type into the cell.

How can I apply what seems to be two lots of data validation into one cell? Or is there a workaround that preferably doesn't require VBA.

Thanks in advance
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If you can be absolutely certain that A4 is populated with something, and definitely not blank, then try this . . .

=OR(AND(A4="YES",A5="YES"),AND(A4="YES",A5="NO"),AND(A4="YES",A5="NOT SURE"))

This will allow any of the three values to be input into A5, but ONLY if A4 contains "YES".
If A4 contains "NO", or for that matter any other entry, nothing can be input to A5.

Two problems with this -
1) If A4 is blank, it will allow any value to be input to A5
2) The options for A5 don't appear as a drop down box.
 
Upvote 0
I don't know of a non vba solution but if one does not pop up, this is pretty easy to use.

Copy this into the sheet module of the sheet with the drop downs. Then select No or Not Sure in A4, try to enter something in A5.

Howard

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target <> Range("A5") Then Exit Sub
 
 Dim noE$
 
 noE = [A4]
 
 Application.EnableEvents = False
 
 If Target.Offset(-1, 0) = "Not Sure" Or Target.Offset(-1, 0) = "No" Then
 
   MsgBox "No entry allowed in " & """A5""" & " with entry of " _
                                 & """" & noE & """" & " In " _
                                 & """A4"" " & "", vbOKOnly + vbCritical
   [A5].ClearContents
   
 End If
 
 Application.EnableEvents = True
End Sub
 
Upvote 0
People, please help

Cells A1:A5 have data validation allowing a drop down selection of one of: 'yes', 'no' and 'not sure'.
This works fine.

But I need to add in an extra validation in cell A5 whereby if the selection in A4 is either 'No', or 'not sure', then no entry can be made into cell A5. I don't want people to be able to select an answer or type into the cell.

How can I apply what seems to be two lots of data validation into one cell? Or is there a workaround that preferably doesn't require VBA.

Thanks in advance

Hi

It's a bit of a codge but here goes
define two ranges C1:C3 and D1
name them listyes and listno, let cell
c1= yes c2= no and c3= not sure ,leave cell d1 empty, you can put these ranges anywhere even on a different sheet.
Edit the data validation rule for cell a5
in the allow settings choose > list and in
source type > =IF(OR(A4="no",A4="not sure"),listno,listyes)

You can simulate the greying out of cell a5 by using conditioal formatting with ccursor in cell a5 select conditional formatting and select formula type in > =OR(A4="no",A4="not sure") and make the background and font colour light grey.

Regards
Murphy123
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,454
Members
449,083
Latest member
Ava19

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