+ Reply to Thread
Results 1 to 9 of 9

Search Range using IF AND Functions - #VALUE! error

  1. #1
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Search Range using IF AND Functions - #VALUE! error

    Good Morning Everyone,

    I am having an issue with two Excel functions and was hoping the professionals might be able to point me in the correct direction to solve this issue.

    I am creating a dimensional layout template for my work. We test component dimensions and I want to create a formal document to standardize the layout and provide some minimal statistics. I have ran into an issue with comparing a range of data values to an upper and lower spec limit.

    I want to create a formula that will search my sample data and compare to the given upper and lower spec limit for the dimension being measured. I am using the IF and AND formulas to accomplish this task, however, my formula returns a #VALUE! Error. I would like the formula to return “Pass” if the data is within the upper and lower spec limit. I would like the formula to return “Fail” if any value in my sample data is outside the upper and lower spec limit.

    I have double checked to ensure my cells are formatted as numerical and there are no periods, commas, or spaces in the cells I’m applying the formula to. If someone could take a look I would appreciate it.

    Here is the formula I’m attempting to use:

    Please Login or Register  to view this content.
    I have also included an example Excel sheet for your reference.

    Side note: I would like to use conditional formatting to highlight (background in red) any sample data outside the upper and lower limits. Any idea how I might do this? Conditional formatting only has a “Between” function. I would need the opposite. The use of VBA is always an option.

    Thank you so much for any support you may be able to give.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Search Range using IF AND Functions - #VALUE! error

    C24:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    Mr. Johnson,

    Thank you so much for your reply. Just wondering, can this comparison be solved a number of ways or was my IF AND combination simply incorrect for this type of scenario?

    I’m am unfamiliar with the SUMPRODUCT formula and I’m trying to better understand how it works in case I need to use it again in the future. After playing with the formula I believe I have an understanding now but just wondered if you or someone else could verify my thinking behind how this equation works.
    When using the – syntax, does SUMPRODUCT load the values of the range into an array as either a 1, if G10>=F10 and so on through the range. Then it does the same thing for G10<=E10, again giving a value of 1 if the criteria is met and a 0 if not. Then does the SUMPRODUCT formula multiply {array1, value1} and {array2, value1}? For example, if G10>=F10 that would return a value of 1 in {array1, value1} and if G10<=E10 then that would return a value of 1 in {array2, value2}; then SUMPRODUCT(--({array1, value1}*{array2, value 1})) would return 1? Correct?

    If either value did not meet the criteria then the array value would return 0, and after being multiplied against the other array the SUMPRODUCT end result would be 0?

    After the SUMPRODUCT formula cycles through the arrays the end result is compared to the count value, in my case 10?

    Just trying to better understand how this formula works, but I do appreciate the support. Also, thank you for your example concerning conditional formatting!

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Search Range using IF AND Functions - #VALUE! error

    Yes, that's true, my only comment is that the comparison "G10>=F10" would return an array of True/False values so we use double negation (--) to convert them to 1's & 0's numerics for the summing.

    Note that your formula will work an an array entered formula, that is you, press Ctro+Shift+Enter instead of just "Enter"
    Last edited by protonLeah; 12-14-2014 at 09:00 PM.

  5. #5
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    Mr. Johnson,

    Thank you for clarifying that. I think I have a better understanding of how this works now.

    Additionally, is there a way I could modify your conditional formatting code to not apply to blank cells? For example, if I only test 5 samples, samples 6-10 will display as non-conforming and cause a failed reading. Is there a way to disregard blank cells?

  6. #6
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    Opps NM; I used CF to remove the formatting for cells that contain blank values.

    Thank you very much for your support. I will also try using my formula as an array formula.

  7. #7
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    Good Morning,

    After trying Mr. Johnson’s formula above I have found it works well 99% of the time. I have been struggling to make it work the other 1% and have yet to find a solution or alternative. So here I am again to ask for help. After testing the SUMPRODUCT function, I have found there are some issues when it encounters the number zero.

    As mentioned above, I am creating a form to submit test results for our lab. I would like to display whether all the measurements were in spec or not and some basic statics about the data. The issue I have ran into arises when my test data has a lower limit (LSL) of zero and a sample size of less than ten measurements.

    I have attached an excel sheet to play with. As the sheet sits all items should fail and should display “Fail” in column C of the data analysis section. As you can see my LSL is set to zero, if I set to 1, everything works properly. Strange that the formula works with a LSL of zero and data for ten measurements, but there will be many instances where less than ten measurements will be taken, and in this event the calculation is incorrect.

    Any thoughts or suggestions would be greatly appreciated. Thank you and Merry Christmas.

    P.S. Ok unsure how to attach this excel file, here are some screen shots until I can figure out how to attach to a reply msg.

    2014-12-24_9-23-31.jpg
    2014-12-24_9-24-47.jpg

  8. #8
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    ahh, advance reply...

    Example Dim Template(bvj).xlsm

  9. #9
    Registered User
    Join Date
    12-10-2014
    Location
    Midwest
    MS-Off Ver
    MS 2010/MS 2013
    Posts
    12

    Re: Search Range using IF AND Functions - #VALUE! error

    think i may have found a solution. added an array excluding blanks to the SUMPRODUCT and now seems to be functioning. still testing tho.

    Please Login or Register  to view this content.

+ 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. Type Mismatch error when calculating a set of functions on a multiple range
    By AnnaDana in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2013, 02:27 PM
  2. Error handling in functions within other functions.
    By marlonsaveri in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-03-2011, 09:13 PM
  3. Error in range search code
    By TyeJae in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2008, 09:36 AM
  4. search functions
    By iain hamilton in forum Excel General
    Replies: 6
    Last Post: 04-21-2008, 05:18 PM
  5. Need help using search functions
    By cburgess57 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2005, 05:06 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