+ Reply to Thread
Results 1 to 4 of 4

IF function with drop-down list

  1. #1
    Registered User
    Join Date
    04-28-2015
    Location
    Montréal, Canada
    MS-Off Ver
    2013
    Posts
    2

    IF function with drop-down list

    Hello, it's yet another question with the IF function and the drop-down list. I know there are numerous threads already about it, but I can't use the INDIRECT function in my context.

    In short, my excel program asks the user to input some numbers.
    Example:
    What is your age : [ B3 ]
    What age did you graduate : [ B4 ]

    =IF(B4<B3,"show the drop-down list but I dont know how", "Impossible")

    Basically, if the logical test is true, I want to show a drop-down list.
    If it's false, I want it to show impossible.

    Thank you for the help... I can provide more information if it wasn't clear!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF function with drop-down list

    To do exactly as you want would require an event macro.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    04-28-2015
    Location
    Montréal, Canada
    MS-Off Ver
    2013
    Posts
    2

    Re: IF function with drop-down list

    Ty for the reply...
    I didn't know what macros were, but I can probably figure out the basic coding. But I couldn't find the code to make a drop-down list. How do I do it?

    EDIT: My code so far just to show that I tried:
    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim Number1As Integer, Number2 As Integer
    Number1= Range("D5").Value
    Number2= Range("H5").Value

    If Number1<= Number2 Then
    Range("N15").Value = "DROP-DOWN LIST!!!!!!"

    Else
    Range("N15").Value = "It works"

    End If

    End Sub
    So yeah. I'm at the drop down list code now.

    EDIT: Okai Problem solved.

    If Number1> Number2 Then
    Range("N15").Value =""

    And put the dropdown list with Data Validation on N15.

    Basically, if Number1 is bigger than Number2, this macro will hide the value on N15 (or actually erase it). So the cell will appear empty if the logical test is true. If it's false, the drop-down list will appear like normal.


    It's probably not the best way to do it, but it'll work I guess. Imma have some fun with the macros from now on 8)
    Last edited by hobo1999; 04-29-2015 at 12:19 AM.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF function with drop-down list

    Try posting in the Excel Programming / VBA / Macros subforum.

    Post a link back to this thread so folks can see what has already been discussed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Drop Down List Function
    By salmanjan in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-23-2014, 08:05 PM
  2. Drop down list dependant on IF function
    By Julian Philips in forum Excel General
    Replies: 1
    Last Post: 03-18-2013, 09:11 AM
  3. [SOLVED] sumif function using a drop list
    By wayneg in forum Excel General
    Replies: 2
    Last Post: 11-28-2012, 12:28 PM
  4. [SOLVED] IF Function Return Drop-Down List
    By bRob in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-19-2012, 05:32 PM
  5. IF function and a drop down list validation.
    By Stevie-B in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-15-2008, 02:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1