Home » excel » excel – SUMIFS with nested AND, OR, and inequalities

# excel – SUMIFS with nested AND, OR, and inequalities

Posted by: admin May 14, 2020 Leave a comment

Questions:

The following formula doesn’t work:

``````=SUMIFS(JOBS_NUMBER,JOB_TYPE,\$A10,MONTH_CLAIMED,(AND(OR(">"&\$H\$7,"="& \$H\$7), OR("<"&\$J\$7,"=" &\$J\$7))),SECTOR, "=Residential")
``````

I’m trying to sum the number of jobs:

• if the range JOB_TYPE matches,
• if the MONTH_CLAIMED is greater than or equal to `H7` (which contains the start of the fiscal year) AND less than or equal to `J7` (which is the end of the fiscal year), and
• the SECTOR must be `Residential`.

The embedded And(OR(inequalities are the problem, since the following test formula returns `0`:

``````=SUMIF(Z8, AND(OR(">"&\$H\$7,"="&\$H\$7),OR("<"&\$J\$7,"="&\$J\$7)),Y8)
``````

where `Z8` is a date between `H7` and `J7`, and `Y8` is `1`.

I’d appreciate help with correcting the syntax or possible alternatives to accomplish the same task.

How to&Answers:

Assuming,the required Job Type is in A10, and you wish to sum relevant values in ColumnY rows 7 to 12 inclusive, this may help:

``````=SUMIFS(Y7:Y12,JOB_TYPE,A10,Z7:Z12,">="&H7,Z7:Z12,"<="&J7,Sector,"Residential")
``````

However the above does assume compatibility between MONTH_CLAIMED and dates elsewhere.

### Answer：

You should use:

``````=sumifs(Y8, Z8, ">="&\$H\$7, Z8, "<="&\$J\$7)
``````

No need for the AND / OR

Hope this helps