+ Reply to Thread
Results 1 to 14 of 14

List as a value in IF statement

  1. #1
    Registered User
    Join Date
    08-20-2018
    Location
    Wirral, England
    MS-Off Ver
    2019
    Posts
    15

    List as a value in IF statement

    Hi All,

    This is my first post here after having used this site many times in the past to look into excel issue I have encountered. This appears to be a simple thing to do but for the life of me I cannot make it work.

    =IF(D2="No",0,Vars!B4:B5)

    I need to check the value of a cell (D2) this contains a list of Yes and No and if I select No I get the correct value of 0 but if I select Yes I get #VALUE! in cell, in the Vars sheet B4&5 have two different values which I need to choose between. Am I trying to achieve this to simply and need to expand on what I have already?

    Thanks for taking the time to read this.

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: List as a value in IF statement

    the reason is a cell can only contain 1 values, you are wanting it to display 2 which it can't

    you could do something similar as the validation for the cells, but this would not change existing values and you would have to select

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: List as a value in IF statement

    You will def get a #VALUE error with that formula.

    What are you trying to do?

    If D2 is "No" return 0

    What do you want to happen if D2 is not "No" ?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    08-20-2018
    Location
    Wirral, England
    MS-Off Ver
    2019
    Posts
    15

    Re: List as a value in IF statement

    As there are only choose able options in D2 I know if they don't choose No it must be Yes so the outcome is controlled.

  5. #5
    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,127

    Re: List as a value in IF statement

    Does this help?? Select value in D2 and then in E2....
    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

  6. #6
    Registered User
    Join Date
    08-20-2018
    Location
    Wirral, England
    MS-Off Ver
    2019
    Posts
    15

    Re: List as a value in IF statement

    Hi Glen , many thanks. It is perfect but I cannot see how you achieved it

  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,127

    Re: List as a value in IF statement

    Black magic...
    I created two named ranges, one called Yes, the other, No. CTRL-F3 to view them. "Yes" refers to B4 & B5 and "No" to a single cell containing a zero.

    I then used Data Validation in D2:

    Data/Data Validation/List/ and put Yes,No in the "Source" box.

    And in E2:
    =INDIRECT(D2)

    That's it...

  8. #8
    Registered User
    Join Date
    08-20-2018
    Location
    Wirral, England
    MS-Off Ver
    2019
    Posts
    15

    Re: List as a value in IF statement

    Glenn you are a gent!

  9. #9
    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,127

    Re: List as a value in IF statement

    You're welcome and thanks for the rep.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: List as a value in IF statement

    Glenn, stay away from the dark (black) side, anger and hate only, will you find there

    MTFBWY
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  11. #11
    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,127

    Re: List as a value in IF statement

    I'm in an RV in France at the moment and have just noticed that the end box on the exhaust is about to drop off. I have 3hrs drive tomorrow and plenty of anger, hate and fear about the size of The Invoice That Is To Come...

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: List as a value in IF statement

    ouch!! good luck my friend

  13. #13
    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,127

    Re: List as a value in IF statement

    Only one thing for it.... Hi-volume Willie Nelson while on the road.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: List as a value in IF statement

    Yup, told the wife if her car makes funny noises, turn up the radio

+ 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. Replies: 4
    Last Post: 06-21-2016, 06:38 AM
  2. [SOLVED] If statement to look down a list
    By wayneg in forum Excel General
    Replies: 2
    Last Post: 11-28-2013, 11:01 AM
  3. [SOLVED] If statement from a list, returning from different list
    By shnolan in forum Excel General
    Replies: 2
    Last Post: 05-24-2012, 12:56 PM
  4. List from IF Statement
    By barrymac20 in forum Excel General
    Replies: 0
    Last Post: 05-18-2011, 06:15 AM
  5. a list within an IF statement?
    By gdallas in forum Excel General
    Replies: 7
    Last Post: 02-03-2010, 05:44 PM
  6. IF Statement for a list.
    By Branno in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-13-2009, 11:57 PM
  7. IF Statement and List?
    By sabunabu in forum Excel General
    Replies: 4
    Last Post: 11-19-2008, 04:05 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