Data Validation and Formula in Same Cell

donaldh

New Member
Joined
Feb 23, 2018
Messages
2
Hi,

I'm looking for a way to have a if formula and data validation in the same cell so if i have in A1 Peaches, Pears, Bananas, in a Data Validation is there a way that if none of them are selected i can have "Please Choose from the list of fruit in Drop Down" as a formula in the same cell. As i don't want to include it into the Data Validation.

Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

Highlight subject cell, select Data Validation, click Input Message tab, enter whatever you want.
When that cell is selected, the message will show.
 
Upvote 0
Hi,

I want the message to be in the cell itself and not a as pop message when the cell is selected.
 
Upvote 0
Then just enter the text/message you want directly into the cell Before you apply Data Validation.
 
Upvote 0
Two other options to consider. In each case the DV cell of mine is coloured yellow to highlight it.

A. Insert a new row 1 so that your DV cell is now A2. Put the formula shown into A1 and then whenever the DV cell is empty, the message will appear.

#VALUE!




B. If you are able to use macros and can ensure that all users of the sheet will be enabling macros you could try this method. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim DVCell As Range
  
  Set DVCell = Range("A1")
  If Not Intersect(Target, DVCell) Is Nothing Then
    If IsEmpty(DVCell.Value) Then DVCell.Value = "Please choose from the list of fruit in Drop Down"
  End If
End Sub
For this scenario, you could initially populate the message in cell A1 before applying the DV (as suggested by jtakw, & as shown below) but then subsequently if a DV value is chosen but then cleared the message would re-appear (provided macros are enabled)

Excel Workbook
AB
1Please choose from the list of fruit in Drop Down
2
DV B
#VALUE!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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