+ Reply to Thread
Results 1 to 7 of 7

Formula reporting OR rather than AND

Hybrid View

  1. #1
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Formula reporting OR rather than AND

    Ive been trying to work out where I have gone wrong below, but cant see for looking

    The formula seems to be counting whether cells meet one OR the other criteria, rather than both.

    In the case below it is reporting 4 instances, which is right for EC16:120=15 OR EE16:120>29, but there are actually 0 instances of both.

    =SUMPRODUCT(SUBTOTAL(2,OFFSET('Y6 R'!$EC$16,ROW('Y6 R'!$EC$16:$EC$120)-ROW('Y6 R'!$EC$16),0)),('Y6 R'!$EC$16:$EC$120=15)*('Y6 R'!$EE$16:$EE$120>29))
    Any ideas?

    The reason for it not being a simple formula is that is has to work under filtering.

    Thanks
    Last edited by dazbear; 11-28-2014 at 01:44 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula reporting OR rather than AND

    In my testing of your formula, it's returning correct values.

    Can you post a sample workbook that exhibits the problem you're seeing?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Re: Formula reporting OR rather than AND

    Thanks Ron

    Posting is a bit tricky as this formula references data on another sheet, which in turn references data on another workbook :os

    It is strange, as only happening in some cells and not in others, despite having almost the same formula - all in the same column though.

    For example the formula below works beautifully....

    =SUMPRODUCT(SUBTOTAL(2,OFFSET('Y6 R'!$EC$16,ROW('Y6 R'!$EC$16:$EC$120)-ROW('Y6 R'!$EC$16),0)),('Y6 R'!$EC$16:$EC$120>17)*('Y6 R'!$EE$16:$EE$120>=30))

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula reporting OR rather than AND

    I'm guessing the problem is not with the formula, but with the linking.
    FWIW...I NEVER link a workbook to another workbook. Links seem convenient, at first, but they're just waiting to fail at the worst possible time.

  5. #5
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Re: Formula reporting OR rather than AND

    I think I sussed where the issue lies.

    Sometimes, while there is a value in EC the corresponding EE cell may be blank.

    The formula seems to be seeing this as >29 and adding it to the total.

    Any ideas?

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula reporting OR rather than AND

    If the EE value is blank...the formula works properly.
    However. a text blank ("") is NOT a blank. It's empty text.
    Try this:
    =SUMPRODUCT(SUBTOTAL(2,OFFSET('Y6 R'!$EC$16,ROW('Y6 R'!$EC$16:$EC$120)-ROW('Y6 R'!$EC$16),0))
    ,('Y6 R'!$EC$16:$EC$120=15)*('Y6 R'!$EE$16:$EE$120<>"")*('Y6 R'!$EE$16:$EE$120>29))
    Better?

  7. #7
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Re: Formula reporting OR rather than AND

    It just reports 0 all the time now

    You have hit the nail on the head though!

    Cells in EC and EE do populate a text blank "" if in error, to stop #N/A appearing - which really messes the whole lot up.

    =IF(ISERROR((CM23)),"",((CM23)))
    Perhaps it is here I should be looking more than the formula posted earlier?

+ 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. [SOLVED] Alternate formula for VLOOKUP in reporting.
    By luccallens in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 12:38 PM
  2. Formula: Reporting first value higher than...
    By sjlabrie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-22-2011, 10:23 PM
  3. If formula not reporting desired solution
    By stenna94 in forum Excel General
    Replies: 1
    Last Post: 04-16-2010, 05:28 AM
  4. A nested formula needed: Sales reporting
    By bimmer5dude in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-11-2008, 10:44 AM
  5. Decile Reporting function or formula
    By zacksba in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-18-2006, 01:54 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