+ Reply to Thread
Results 1 to 23 of 23

If condition to show list based upon another cell value

  1. #1
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    If condition to show list based upon another cell value

    Hello everyone. I am trying to add a list to a cell using data validation. What I am trying to accomplish is basically: if cell A1 equals 1 then show list, otherwise show blank (or no list will be shown), however I cannot get it to work that simply. What I have tried is adding a data validation using custom and then including the following formula: =IF($A$1="1",List,""), however this does not work. If this is possible, could someone please help me with the proper method of doing this?
    Last edited by tm1274; 07-07-2021 at 08:33 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: If condition to show list based upon another cell value

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.

    Also add your excel version to your profile please

  3. #3
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Hello Pepe Le Mokko, Thank you for your reply. I have made the requested changes and attached the sample file.
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,207

    Re: If condition to show list based upon another cell value

    In DV Settings allow LIST (not custom) and use:

    =IF($A$1=1,List,"")

    The "" around the 1 turns it into text.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Thanks Glenn, That worked perfectly. I never realized that the "" turned it into text. That explains why my original use of allow list instead of custom didn't work and returned an error that the list needed to be delimited.

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,498

    Re: If condition to show list based upon another cell value

    Try this
    Cell D1
    Attached Images Attached Images
    Attached Files Attached Files

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,207

    Re: If condition to show list based upon another cell value

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    I just realized that the formula =IF($A$1=1,List,"") does not actually make the cell D1 blank if anything but 1 is selected in A1. Is it possible to make cell D1 (where the list is shown) blank if the value in A1 is anything but 1?

  9. #9
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    I have updated my sample sheet to hopefully explain better what I am looking to accomplish. Does anyone know if clearing the cell value when a selection is made is possible using the data validation?
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: If condition to show list based upon another cell value

    With data validation is not possible, only with VBA as a event on change to the worksheet.
    HTML Code: 
    I am using Excel 2019 and I don't remember if this is working in 2003 worksheets
    Attached Files Attached Files
    Diana Tanase


    If the solutions offered helped you to solve your problem, then mark the thread as SOLVED (thread tools in the top menu) and you can click on * to add reputation to those who helped you, as a way to say thank you !

  11. #11
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    I was hoping that the data validation would do it. The VBA did work in 2010 when I tested it. Thanks for your reply.

  12. #12
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Hello tanasedn. Your response worked great but I am wondering if you could tell me, is it possible to set a second range that would clear other cells? I have tried the following but with no real VBA experience, I am having trouble figuring out what I am doing wrong. Would it need a completely different Worksheet_Change event to clear other cells with a different range?:

    Please Login or Register  to view this content.
    Last edited by Glenn Kennedy; 07-09-2021 at 11:21 AM.

  13. #13
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: If condition to show list based upon another cell value

    What you really want to do? Not how you try to do it. I don't understand what is the connection between A1, D3 and G column

  14. #14
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    I apologize. A1 is no longer being used as the reference range as it was originally. It is now D3. What I have currently working is if D3 equals less than 1 then cell G1 would be blank and then if D3 equals less than 2 then cell G2 would be blank and so on. What I am trying to do is add another range in the code such as G1, if it is < 1 then cell C12 would be blank.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,207

    Re: If condition to show list based upon another cell value

    Tm1274, please take a moment to re-read Rule 2 about code tags. I have added them this time, at Post 12.

  16. #16
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: If condition to show list based upon another cell value

    Quote Originally Posted by tm1274 View Post
    I apologize. A1 is no longer being used as the reference range as it was originally. It is now D3. What I have currently working is if D3 equals less than 1 then cell G1 would be blank and then if D3 equals less than 2 then cell G2 would be blank and so on. What I am trying to do is add another range in the code such as G1, if it is < 1 then cell C12 would be blank.
    Please, please, please attach a sample file!

  17. #17
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Sure. Let me create one without any critical data in it and I will post it.

  18. #18
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Hopefully this example workbook will help explain what I am trying to accomplish. Please let me know if you have any other questions.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Thanks Glenn. I apologize for that mistake. It has been quite a long time since I had last posted and need a refresher on the forum rules. Looking at them now.....

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,207

    Re: If condition to show list based upon another cell value

    tm1274... no problem!! I'll ask you questions about them tomorrow

  21. #21
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,207

    Re: If condition to show list based upon another cell value

    Incidentally, are you still using Excel 2010? If not, can you update your profile? It would also help if you provided a rough indication of where you are...as solutions offered can depend on both Excel version and national location.

  22. #22
    Registered User
    Join Date
    10-28-2005
    Location
    United States
    MS-Off Ver
    Office 2010 - Win
    Posts
    38

    Re: If condition to show list based upon another cell value

    Yes, still using Excel 2010. I added my location as well. Looks like the last time I was on the forum was 2014, so it's been a couple days.
    Last edited by tm1274; 07-09-2021 at 02:30 PM.

  23. #23
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: If condition to show list based upon another cell value

    I worked a little on your problem and I came to a result close to what you want. However, I did not manage to build the code in such a way that when in D3 you return to the value 0, all the previous elements are deleted. This is all that I can for the moment.
    HTML Code: 
    Attached Files Attached Files

+ 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. Combine and show two list in data validation with if condition
    By arunvijilan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-02-2020, 06:07 AM
  2. How to show Images in a Cell based on a condition?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 08-15-2014, 08:00 AM
  3. [SOLVED] formula required to list cell values based on condition
    By kiranpat in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2014, 04:54 AM
  4. Show/Hide a sepcific column based on a condition in a cell
    By uakhan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2013, 05:50 AM
  5. Code How to show alert messages with the IF condition based on other cell value
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2013, 09:51 PM
  6. [SOLVED] Show a unique list of items based on Cell value
    By gorgon777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-10-2013, 12:18 PM
  7. Replies: 4
    Last Post: 05-25-2012, 04:16 AM

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