+ Reply to Thread
Results 1 to 12 of 12

If cell value is equal to or between values

  1. #1
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    If cell value is equal to or between values

    Hi All, looking for help with the following.
    Cell B7 = required length.
    Cell G7 = actual length.
    Cell G5 = minimum length.
    Cell H5 = B7 + 10
    Cell I5 = B7 + 1%
    Cell J6 = Result

    I would like J6 to display "PASS" if G7 is equal to G5 or Between G5 and H5 or I5

    J6 would display "FAIL" if above is not met (or G7 is less than G5 or not Between H5 and I5)
    Background would be solid red for fail and solid green for pass.

    So in words the measured length must be equal to the required length (no less) and equal to the required length + 1% or 10 (not %) whichever is the greatest.
    Example 1
    800mm required.
    Measurements and results below.
    799- Fail
    800 to 810 Pass
    811+ Fail

    Many thanks for looking.
    Last edited by maax555; 01-15-2025 at 11:38 AM. Reason: Solved

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,085

    Re: If cell value is equal to or between values

    how about
    =If( And( B7>=G5, OR( B7<=H5, B7<=I5)), "Pass", "Fail")


    A sample sheet would help here, and possibly will enable a quicker and more accurate solution for you.


    The forum does allow for spreadsheets to be uploaded direct to the forum -

    Please see the Yellow Banner at the top of the page explaining how to attach a sample spreadsheet

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.

    Here are the instructions, found at the top of the page again
    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,924

    Re: If cell value is equal to or between values

    Another option:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by ByteMarks; 01-14-2025 at 11:15 AM.

  4. #4
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: If cell value is equal to or between values

    Try, =IF(AND(G7>=G5,G7>=MIN(H5,I5),G7<=MAX(H5,I5)),"Pass","Fail")

  5. #5
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    Re: If cell value is equal to or between values

    Thanks to all for looking at this. I am testing suggestions.

  6. #6
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    Re: If cell value is equal to or between values

    Hi Joseph, many thanks. I have downloaded this and see that A fail is being returned when actual length is equal to required length and also less than maximum length.
    Its probably down to my explanation of requirement.

    So for a pass the length needs to be equal to minimum (which is always for this project required length - 0. For other projects the the minimum required may be length - 10.)
    Once I get this working as it is I am hoping to add a tolerance for minimum and maximum.

    And for the maximum the actual length must be required length + 1% or required length + 10mm (which ever is the greater.
    So for the example of 800 required actual length should be between 800 and 810 ( 10mm added at 1% is less than 10mm)
    For say 2000 the length to pass should be between 2000 and 2020 (now 2000 + 1% = 20 which is bigger than the 10mm)

    Hope this is a little clearer?

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,085

    Re: If cell value is equal to or between values

    did you try my suggestion
    =If( And( B7>=G5, OR( B7<=H5, B7<=I5)), "Pass", "Fail")

  8. #8
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: If cell value is equal to or between values

    Try, =IF(AND(G7>=G5,G7<=MAX(H5,I5)),"Pass","Fail")

  9. #9
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    Re: If cell value is equal to or between values

    Hi Joseph, yes this now works, many thanks. It works with 0 in tolerance. I changed it so you need to type in -10 for the minimum tolerance, so minimum length at G5 is now B7 + G3. Also added max tolerance in % option.
    Many thanks again.

  10. #10
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    Re: If cell value is equal to or between values

    thanks to all for looking :-)

  11. #11
    Forum Contributor
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    122

    Re: If cell value is equal to or between values

    Quote Originally Posted by etaf View Post
    did you try my suggestion
    =If( And( B7>=G5, OR( B7<=H5, B7<=I5)), "Pass", "Fail")
    Hi, thanks, however this returned a pass no matter what actual length I entered.

  12. #12
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: If cell value is equal to or between values

    You are welcome, thanks for the feedback and Rep.

+ 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: 1
    Last Post: 11-07-2018, 05:48 PM
  2. [SOLVED] Delete row if cell values equal the same value
    By frostii in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-30-2016, 06:25 PM
  3. [SOLVED] COUNTIFS function w/greater than or equal to, and less than or equal to time values
    By AliciaRenee in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-27-2014, 03:57 PM
  4. Replies: 2
    Last Post: 05-14-2013, 05:46 PM
  5. [SOLVED] cell not equal to two values, return a third value
    By acp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-10-2012, 03:37 PM
  6. Devide by cell if two values are equal
    By Savan87 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-26-2012, 07:37 AM
  7. Message Box when 2 Cell values equal
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2008, 05:39 PM

Tags for this Thread

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