Question: I'm started with the following:

```
=SUMIF(MONTH('Inventory'!K:K),B5,'Inventory'!M:M)

```

where `MONTH('Inventory'!K:K)` is supposed to return the month number (Jan=1, Feb=2, etc.) from a mm/dd/yyyy date column, B5 holds the month number I want to sum by, and `'Inventory'!M:M` is an amount column.

In place of `MONTH('Inventory'!K:K)` I also tried `LEFT('Inventory'!K:K, 1)` with no luck.

I though possibly that the MONTH expression is returning a value where Excel is looking for a Range, but I wasn't able to find a workaround. Tried the following, which also didn't work:

```
=SUMIF('Inventory'!K:K,MONTH('Inventory'!K:K)=B5,'Inventory'!M:M)

```

While a pivot could work, I wanted the user to be able to just add to the Inventory tab without worrying about refreshing.

Answer: 
How about using some variables?

```
var ex1 = this.exercisesDoneArray[ind][i],
    ex2 = this.exercisesDoneArray[ind][1],
    nextSlide = this.slides.clickedSlide.nextElementSibling.nextElementSibling.id;

if(ex1.done && ex2.done && ex1.exercise === nextSlide || ex2.exercise === nextSlide){

```
Use few variables and then put outside the global if another if where you check if your main excercise has been done, because it has always to be done so no need to check always inside the other if with an and

```
var currentExcercise = this.exercisesDoneArray[ind][i];
var baseExcercise = this.exercisesDoneArray[ind][1];
var slideId = this.slides.clickedSlide.nextElementSibling.nextElementSibling.id;

if (!baseExcercise.done) {
    return false;
}
if(currentExcercise.done && currentExcercise.exercise === slideId  || baseExcercise .exercise === slideId ){

```