0
votes

I have been using the following formula in a google docs spreadsheet for the past few months. About 4 weeks ago it stopped working. I can't figure out why - haven't found anything stating that there has been a change to how the formula works, and haven't made and changes to my data.

The error I get is:

"Error: argument is blank", not very helpful.

Here is the formula:

=arrayformula(
        sum(
            (Sheet1!$B$2:$B$100458=$A3)
            *
            (arrayformula(
                month(Sheet1!$A$2:$A$100458)
                )
                = month(C$1)
            )
            *
            (arrayformula(
                year(Sheet1!$A$2:$A$100458)
                )
                =year(C$1)
            )
        )
    )

It has a unique ID in the first column, and a date (1st of each month) in the top row. It then goes through sheet 1, looking for how many records match that ID in the month and year and returns the count. It was working fine for a while, no idea what happened. I even tried going back to the revision history and haven't found any differences.

1

1 Answers

0
votes

Not sure why it worked before, but after working through each step, this is what I had to do to get it working.

=arrayformula(
    sum(
        iferror(
            arrayformula(Sheet1!$B$2:$B$100458=$A3)
            , FALSE
        )
        *
        iferror(
            arrayformula(
                month(Sheet1!$A$2:$A$100458)
                = month(C$1)
            )
            ,FALSE
        )
        *
        iferror(
            arrayformula(
                year(Sheet1!$A$2:$A$100458)  
                =year(C$1)
            )
            ,FALSE
        )   
    )
)

Basically re-ordering some of the arrayformula's and adding the iferror() functions. Seemed that the arrayformulas were throwing errors instead of false when it got passed the end of records, and sum was therefore also throwing an error. Iferror() fixed that up.