Question:
In Excel, based on text in one cell can I make the results of the next cell either be zero or dropdown choice?
17 years ago
In cell B5 I have a dropdown box with the options of yes or no. If the answer in B5 is no I want B6 to automically become a zero. If the answer in B5 is yes then I want B6 to offer a dropdown box with numbers 1-20.

Let me know if this is possible and how I would go about doing this!
Four answers:
17 years ago
Excel > Formula and name basics > Examples of formulas > Conditional

Create conditional formulas

Show All

Hide All

Testing whether conditions are true or false and making logical comparisons between expressions are common to many tasks. You can use the AND, OR, NOT, and IF function to create conditional formulas.



The IF function uses the following arguments.





--------------------------------------------------------------------------------



Formula with the IF function

logical_test: The condition that you want to check.



value_if_true: The value to return if the condition is true.



value_if_false: The value to return if the condition is false.





--------------------------------------------------------------------------------



What do you want to do?



--------------------------------------------------------------------------------



Create a conditional formula that results in a logical value (TRUE or FALSE)



Create a conditional formula that results in another calculation or in values other than TRUE or FALSE





--------------------------------------------------------------------------------



Create a conditional formula that results in a logical value (TRUE or FALSE)

To do this task, use the AND, OR, and NOT functions, and operators (operator: A sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison, logical, and reference operators.).



Example

The example may be easier to understand if you copy it to a blank worksheet.



How to copy an example



Create a blank workbook or worksheet.

Select the example in the Help topic.

Note Do not select the row or column headers.







Selecting an example from Help

Press CTRL+C.

In the worksheet, select cell A1, and press CTRL+V.

To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.



1

2

3

4

A

Data

15

9

8

Sprockets

Widgets

Formula Description (Result)

=AND(A2>A3, A2
=OR(A2>A3, A2
=NOT(A2+A3=24) Is 15 plus 9 not equal to 24? (FALSE)

=NOT(A5="Sprockets") Is A5 not equal to "Sprockets"? (FALSE)

=OR(A5<>"Sprockets",A6 = "Widgets") Is A5 not equal to "Sprockets" or A6 equal to "Widgets"? (TRUE)





Function details

AND



OR



NOT



Top of Page



Create a conditional formula that results in another calculation or in values other than TRUE or FALSE

To do this task, use the IF, AND, and OR functions.



Example

The example may be easier to understand if you copy it to a blank worksheet.



How to copy an example



Create a blank workbook or worksheet.

Select the example in the Help topic.

Note Do not select the row or column headers.







Selecting an example from Help

Press CTRL+C.

In the worksheet, select cell A1, and press CTRL+V.

To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.



1

2

3

4

A

Data

15

9

8

Sprockets

Widgets

Formula Description (Result)

=IF(A2=15, "OK", "Not OK") If the value in cell A2 equals 15, then return "OK". (OK)

=IF(A2<>15, "OK", "Not OK") If the value in cell A2 is not equal to 15, then return "OK". (Not OK)

=IF(NOT(A2<=15), "OK", "Not OK") If the value in cell A2 is not less than or equal to 15, then return "OK". (Not OK)

=IF(A5<>"SPROCKETS", "OK", "Not OK") If the value in cell A5 is not equal to "SPROCKETS", then return "OK". (Not OK)

=IF(AND(A2>A3, A2
=IF(AND(A2<>A3, A2<>A4), "OK", "Not OK") If 15 is not equal to 9 and 15 is not equal to 8, then return "OK". (OK)

=IF(OR(A2>A3, A2
=IF(OR(A5<>"Sprockets", A6<>"Widgets"), "OK", "Not OK") If the value in cell A5 is not equal to "Sprockets" or the value in cell A6 is not equal to "Widgets", then return "OK". (Not OK)

=IF(OR(A2<>A3, A2<>A4), "OK", "Not OK") If 15 is not equal to 9 or 15 is not equal to 8, then return "OK". (OK)





Function details

IF



AND



OR
17 years ago
I'm not sure how that could be done. But you could do this instead: have your Yes/No dropdown box in B5, then you could label B6: "If yes, how much?" (or something like that), and have a dropdown box with 1-20, regardless of what they input in B5. But if they input "no" in B5, then they wouldn't have to pick anything from the dropdown box in B6. And then in B7 you could have an If statement that said that if B5 was "no", then B7 should be 0, and if B5 was "yes", then B7 should be equal to B6.



Edit:

Upon further consideration, I think you could do it exactly the way you described. Create the dropdown box in cell B5. Create a macro that will run whenever the choice in the dropdown box in cell B5 is changed. Have that macro enter 0 in cell B6 if cell B5 is changed to no, and have that macro create another dropdown box with 1-20 in cell B6 if cell B5 is changed to yes.
quartzy123
17 years ago
You need to use the IF function, if cell B5 is True then enter 0 in cell B6 for more resources check out my website. http://www.bytesizeoffice.co.uk/excel2000.htm
Nasa
17 years ago
yes its possible and easy but unfortuanately i don't have excel in this comeputer otherwise i would have told you the exect solution.. any how..

go to help or (press F1) in help window find help of if then else condition,,,,

there would be telling how to use if else condition... c example there how they did it..... ur requirment need and if else condition...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...