+ Reply to Thread
Results 1 to 10 of 10

Data validation (drop down list) - combining 'IF' with 'AND'

  1. #1
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Data validation (drop down list) - combining 'IF' with 'AND'

    I am trying to combine AND and IF statement in data validation.

    I have
    Please Login or Register  to view this content.
    and it does not work

    Any suggestions?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Without having your workbook to test this I am guessing that the problem is that the "else" part of your IF statement is missing. If you did that in a cell, then the result would be FALSE if your condition were not true. But it may be invalid to omit it in a data validation list.

    Please explain what "doesn't work" means.
    • Does it do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, what do you expect, and what do you actually get?
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Quote Originally Posted by 6StringJazzer View Post
    Without having your workbook to test this I am guessing that the problem is that the "else" part of your IF statement is missing. If you did that in a cell, then the result would be FALSE if your condition were not true. But it may be invalid to omit it in a data validation list.

    Please explain what "doesn't work" means.
    • Does it do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, what do you expect, and what do you actually get?
    Thanks for the reply. There is error msg prompted saying: "The list source must be a deimited list, or a reference to single row or column."

    I have 4 drop down lists and source data for lists in different sheets in the workbook. Depending on value i select i want other lists to show me values from selected cells (like you could figure out from the code i posted in my thread).
    Thanks

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    You need to assign a value_if_false parameter on this. Choose an empty cell, make sure it's empty (or have it say "N/A"), and then add a reference to that cell.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where A1 in 'SomeHiddenSheet' is a blank cell.

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Once share your workbook to us with expected result.

  6. #6
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Quote Originally Posted by quekbc View Post
    You need to assign a value_if_false parameter on this. Choose an empty cell, make sure it's empty (or have it say "N/A"), and then add a reference to that cell.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where A1 in 'SomeHiddenSheet' is a blank cell.
    Thanks for this. It did work but unfortunately there is another issue when I add another "IF" statement. The message says "You may not use reference operatos (such as unions, intersections, and ranges) or array constants for Data Validation criteria"



    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Your IF statement "returns" an array if TRUE so I think this the problem: what are you trying to do?

    and is this what you want (apart from the array issue) ...combining the IFs

    =IF(AND($D$12="Mk6e-i2",$F$12="Unmachined",$H$12="CA"),'Mk6e-i2 CA'!$F$9:$G$200,IF(AND($D$12="Mk6e-i2",$F$12="Machined",$H$12="CA"),'Mk6e-i2 CA Machined'!$F$9:$G$200,$A$1))

  8. #8
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Quote Originally Posted by JohnTopley View Post
    Your IF statement "returns" an array if TRUE so I think this the problem: what are you trying to do?

    and is this what you want (apart from the array issue) ...combining the IFs

    =IF(AND($D$12="Mk6e-i2",$F$12="Unmachined",$H$12="CA"),'Mk6e-i2 CA'!$F$9:$G$200,IF(AND($D$12="Mk6e-i2",$F$12="Machined",$H$12="CA"),'Mk6e-i2 CA Machined'!$F$9:$G$200,$A$1))
    Yes, I need the function to return an array (in Data Validation option)
    There is a message when i put your suggestion in, saying " "The list source must be a deimited list, or a reference to single row or column."

  9. #9
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Ah, didn't notice that the first time. The error says exactly what it is.

    The list source must be a delimited list, or a reference to single row or column.

    The references $F$9:$G$200 is 191 rows and 2 columns (i.e. does not fit the criteria above)

  10. #10
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: Data validation (drop down list) - combining 'IF' with 'AND'

    Quote Originally Posted by quekbc View Post
    Ah, didn't notice that the first time. The error says exactly what it is.

    The list source must be a delimited list, or a reference to single row or column.

    The references $F$9:$G$200 is 191 rows and 2 columns (i.e. does not fit the criteria above)

    Nice one
    It does work,

    Rep for You

+ 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: 3
    Last Post: 07-05-2015, 12:45 AM
  2. Replies: 5
    Last Post: 03-26-2015, 01:40 PM
  3. Drop Down List (Data Validation) Need to start at current value in list
    By bigmantitus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-07-2014, 11:14 AM
  4. Data validation List: A macro to initiate drop down list?
    By dchubbock in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-11-2013, 08:12 PM
  5. Replies: 1
    Last Post: 09-05-2012, 11:39 AM
  6. Combining If statement and data validation (non-list)
    By zangana in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 07:54 AM
  7. Replies: 1
    Last Post: 07-08-2005, 11:05 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