Cell should be blank in data validation

Zubair

Active Member
Joined
Jul 4, 2009
Messages
327
Office Version
  1. 2016
Platform
  1. Windows
Dear Experts,

Please change the formula, I want the cells B3:B5 should be blank while selecting "Most Profitable" in B2, similarly if B2 is other then "Most Profitable" B6 should be blank.

Excel help with CHATGPT 3.xlsx
ABCDEFGH
1User selectionNumber of Scenario Number of YearsBusiness ModelNumber of columns
2ViewMost ProfitableScenario 1Y1DF1
3Number of ScenarioScenario 3Scenario 2Y2SF2
4Number of of YearsY3Scenario 3Y3CF3
5Business ModelDFScenario 4Y44
6Number of columns10Scenario 5Y55
7Scenario 6Y66
8Scenario 7Y77
9Scenario 8Y88
10Scenario 9Y99
11Scenario 10Y1010
12Scenario 11Y1111
13Scenario 12Y1212
14Scenario 13Y1313
15Scenario 14Y1414
16Scenario 15Y1515
17Scenario 16Y1616
18Scenario 17Y1717
19Scenario 18Y1818
20Scenario 19Y1919
21Scenario 20Y2020
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332
3433
3534
3635
3736
3837
3938
4039
4140
Multiple condiation data valida
Cells with Data Validation
CellAllowCriteria
B2ListScenario by years, Years by scenario, Most Profitable
B3List=IF($B$2="Most Profitable","",E2:E21)
B4List=IF($B$2="Most Profitable","",F2:F21)
B5List=IF($B$2="Most Profitable","",G2:G4)
B6List=IF($B$2="Most Profitable",H2:H41,"")
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Greetings! I have reworked your lists a little. In the name of the name, he created four parameters List1, List2, List3, List4 data taken from Sheet1.
Also, four parameters "_list1", "_list2", "_list3", "_list4" were created in the dispensary.
List1
VBA Code:
=Sheet1!$E$2:$E$21
List2
VBA Code:
=Sheet1!$F$2:$F$21
List3
VBA Code:
=Sheet1!$G$2:$G$4
List4
VBA Code:
=Sheet1!$H$2:$H$41
The logical formula is recorded for them.
_List1
VBA Code:
=IF(Sheet1!$B$2="Most Profitable";"";List1)
_List2
VBA Code:
=IF(Sheet1!$B$2="Most Profitable";"";_List2)
_List3
VBA Code:
=IF(Sheet1!$B$2="Most Profitable";"";_List3)
_List4
VBA Code:
=IF(Sheet1!$B$2="Most Profitable";List4;"")
For B3, B4, B5, B6, lists were created, where "_list1", "_list2", "_list3", "_list4" are presented in the verification of these.
If in B2 "MOST PROFITABLE", B3, B4, B5 you will not be able to choose anything and they will be empty, and in B6 you will be able to use the choice.
Book1
ABCDEFGH
1User selectionNumber of ScenarioNumber of YearsBusiness ModelNumber of columns
2ViewMost ProfitableScenario 1Y1DF1
3Number of ScenarioScenario 2Y2SF2
4Number of of YearsScenario 3Y3CF3
5Business ModelScenario 4Y44
6Number of columnsScenario 5Y55
7Scenario 6Y66
8Scenario 7Y77
9Scenario 8Y88
10Scenario 9Y99
11Scenario 10Y1010
12Scenario 11Y1111
13Scenario 12Y1212
14Scenario 13Y1313
15Scenario 14Y1414
16Scenario 15Y1515
17Scenario 16Y1616
18Scenario 17Y1717
19Scenario 18Y1818
20Scenario 19Y1919
21Scenario 20Y2020
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332
3433
3534
3635
3736
3837
3938
4039
4140
Sheet1
Cells with Data Validation
CellAllowCriteria
B2ListScenario by years;Years by scenario;Most Profitable
B3List=_List1
B4List=_List2
B5List=_List3
B6List=_List4
 
Upvote 1
Hi Thanks, Many thanks I am unaware how to put VBA codes you have provided, can you please guide ?
 
Upvote 0
On the Formulas tab, in the Defined Names group, click Define Name.
In the New Name dialog box, in the Name box, type the name.
In the Refers to box type = and then type the formula
Screenshot 2025-01-25 091027.png
Thus create 8 names. Here is their listing
List1
Code:
=Sheet1!$E$2:$E$21
List2
Code:
=Sheet1!$F$2:$F$21
List3
Code:
=Sheet1!$G$2:$G$4
List4
Code:
=Sheet1!$H$2:$H$41
_List1
Code:
=IF(Sheet1!$B$2="Most Profitable";"";List1)
_List2
Code:
=IF(Sheet1!$B$2="Most Profitable";"";List2)
_List3
Code:
=IF(Sheet1!$B$2="Most Profitable";"";List3)
_List4
Code:
=IF(Sheet1!$B$2="Most Profitable";List4;"")
As a result, there will be such a picture
Screenshot 2025-01-25 092049.png
For B2, B3, B4, B5, B6, create lists. For B2 with a list of points. For B3, B4, B5, B6, prescribe “_List1”, “_List2”, “_List3”, “_List4”, respectively.
There is one nuance to create lists for B3, B4, B5, the B2 cell should be empty, and when creating a list for B6, on the contrary, "Most Profitable" should be spelled out.
 
Upvote 0
Hi, I have applied your given formula, but its not showing blank in case of "Most Profitable", please check what mistake I am doing.
Excel help with CHATGPT 3.xlsx
ABCDEFGH
1User selectionNumber of Scenario Number of YearsBusiness ModelNumber of columns
2ViewScenario by yearsScenario 1Y1DF1
3Number of ScenarioScenario 4Scenario 2Y2SF2
4Number of of YearsY8Scenario 3Y3CF3
5Business ModelCFScenario 4Y44
6Number of columns7Scenario 5Y55
7Scenario 6Y66
8Scenario 7Y77
9Scenario 8Y88
10Scenario 9Y99
11Scenario 10Y1010
12Scenario 11Y1111
13Scenario 12Y1212
14Scenario 13Y1313
15Scenario 14Y1414
16Scenario 15Y1515
17Scenario 16Y1616
18Scenario 17Y1717
19Scenario 18Y1818
20Scenario 19Y1919
21Scenario 20Y2020
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332
3433
3534
3635
3736
3837
3938
4039
4140
Sheet1
Cells with Data Validation
CellAllowCriteria
B2ListScenario by years, Years by scenario, Most Profitable
B3List=_List1
B4List=_List2
B5List=_List3
B6List=-List4

1737802867250.png
 
Upvote 0
Simple methods will not work. As an option to use conditional formatting. Check B2 for a specific text and set the color of the font with white for the necessary cells.
Запрет выбора списка.xlsx
ABCDEFGH
2ViewScenario by yearsScenario 1Y1DF1
3Number of ScenarioScenario 2Y2SF2
4Number of of YearsScenario 3Y3CF3
5Business ModelScenario 4Y44
6Number of columns4Scenario 5Y55
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3:B5Expression=$B$2="Most Profitable"textNO
B6Expression=$B$2<>"Most Profitable"textNO
Cells with Data Validation
CellAllowCriteria
B2ListScenario by years;Years by scenario;Most Profitable
B3List=_List1
B4List=_List2
B5List=_List3
B6List=_List4
 
Upvote 0
That I have already done, many thanks for your time and solution I am marking this as solved.
 
Upvote 0
If you would like to try a macro, then remove the conditional formatting and copy and paste the macro below into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter a value in B2 and press the ENTER key.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Address(0, 0) <> "B2" Then Exit Sub
    If Target = "Most Profitable" Then
        Range("B3:B5").ClearContents
    Else
        Range("B6").ClearContents
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,902
Messages
6,187,729
Members
453,436
Latest member
MEZHH

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