Consulting

Results 1 to 6 of 6

Thread: Formula with OR condition does not return expected result

  1. #1
    VBAX Regular
    Joined
    Dec 2021
    Posts
    58
    Location

    Formula with OR condition does not return expected result

    Formulae:

    =(ROUND(QUARTIL(E62:E70;2);3)=ROUND(E62;3))*AND(ROUND(E62;3))=300
    Result is FALSE. Expected True.

    Check:
    =(ROUND(QUARTIL(E62:E70;2);3)=ROUND(E62;3))
    and
    =(ROUND(E62;3))=300
    The image bel
    ow contains incorrect operator, should be AND.
    Attached Images Attached Images
    Last edited by vangog; 09-26-2022 at 04:37 AM. Reason: Mistake in formulae

  2. #2
    maybe:

    =AND(ROUND(QUARTILE(E62:E70;2);3), ROUND(E62;3);300)

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    If you actually wanted OR, it's in the wrong place:

    =OR(ROUND(QUARTIL(E62:E70;2);3)=ROUND(E62;3);ROUND(E62;3)=300)
    Be as you wish to seem

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    I've taken the time to breakdown your function into mini tests

    "=Quartile(E62:E70,2)" returns 300
    "=Round(Quartile(E62:E70,2),3)" returns 300
    "=Round(E62,3)" returns 300
    "=Or(Round(E62,3)" returns True
    "=Round(E62,3)*Or(Round(E62,3)" returns 300
    "=Round(Quartile(E62:E70,2),3)=Round(E62,3)*Or(Round(E62,3))" returns 300

    So I can't find any fault on this Mac
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    The quartile of a range that encompasses E62 can only be equal to E62 if the range doesn't contain any values at all, other than the value in E62.
    To test for blank cells in a range a simpler method in Excel is available.

  6. #6
    VBAX Regular
    Joined
    Dec 2021
    Posts
    58
    Location
    Sorry. When I have translated from my local language, I changed AND function to OR. But thank you, now it is clear to me how OR/AND works in Excel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •