Share via

eomonth problem in sumproduct array formula

Anonymous
2018-01-05T14:34:34+00:00

I have a data table where I created a helper field [Month] from the [Production Day] field.  By doing that I get the first formula below to work properly.  I would like to not need the helper field [Month] and have the EOMONTH formula work in the OFFSET function against the [Production Day] field but I haven't had any luck.  I've tried multiple ways to use EOMONTH in and around the OFFSET formula for the [Production Day] without success.  Any ideas?

=SUMPRODUCT(--(OFFSET(DownTime[Month],0,0,,1)=EOMONTH(B$2,0)),--(OFFSET(DownTime[Machine],0,0,,1)=B$3),--(OFFSET(DownTime[Category],0,0,,1)=$A4),(OFFSET(DownTime[Minutes Down],0,0,,1)))

=SUMPRODUCT(--(OFFSET(DownTime[Production Day],0,0,,1)=EOMONTH(B$2,0)),--(OFFSET(DownTime[Machine],0,0,,1)=B$3),--(OFFSET(DownTime[Category],0,0,,1)=$A4),(OFFSET(DownTime[Minutes Down],0,0,,1)))

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2018-01-08T17:49:53+00:00

    Great - happy to hear that you got it worked out: your initial post did not mention multi-year amounts of data, so I was just guessing, but can now see why you were using EOMONTH.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-01-08T15:36:47+00:00

    Bernie,

    Your solution works as long as I add in the additional parameter for the year.  Here is what I ended up with.

    =SUMPRODUCT(--(YEAR(DownTime[Production Day])=YEAR(B$2)),--(MONTH(DownTime[Production Day])=MONTH(B$2)),--(DownTime[Machine]=B$3),--(DownTime[Category]=$A4),(DownTime[Minutes Down]))

    Thanks for the help.

    Stuart

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2018-01-05T23:00:24+00:00

    Did you try (I named my dates "Date" and not Production Day, but his corrects that)

    =SUMPRODUCT((MONTH(Downtime[Production Day])=MONTH(B$2))*(Downtime[Machine]=B$3)*(Downtime[Category]=$A4)*Downtime[Minutes Down])

    EOMONTH as you use it will return the last day of the month - the formula above checks that the month of the production date matches the month of the date in B2.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2018-01-05T17:21:10+00:00

    I updated my formula eliminating the offset which is cleaner, thanks for clarifying that.

    =SUMPRODUCT(--(DownTime[Month]=EOMONTH(B$2,0)),--(DownTime[Machine]=B$3),--(DownTime[Category]=$A4),(DownTime[Minutes Down]))

    However back to my original problem, I'd like to eliminate my helper field [Month] by letting an EOMONTH formula capture the records in the field [Production Day] where the production day falls in the current month identified by the EOMONTH(B$2,0) formula.  When I use the helper column in the formula above I get all the production days that fall in the month from B$2 (11/1/17 in this example), when I use the formula below it gives me the single record where [Production Day] is equal to EOMONTH(B$2,0).

    =SUMPRODUCT(--(DownTime[Production Day]=EOMONTH(B$2,0)),--(DownTime[Machine]=B$3),--(DownTime[Category]=$A4),(DownTime[Minutes Down]))

    When I use the formula below to attempt to get there I get #VALUE!, is there a way to get the EOMONTH result for each record in the [Production Day] field without the helper field [Month]?

    =SUMPRODUCT(--(EOMONTH(DownTime[Production Day],0)=EOMONTH(B$2,0)),--(DownTime[Machine]=B$3),--(DownTime[Category]=$A4),(DownTime[Minutes Down]))

    Thanks again for taking a look at this.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2018-01-05T16:06:27+00:00

    No need to use OFFSET rather than just the table column, (though I'm not sure what you want to do with the dates).

    =SUMPRODUCT((MONTH(Downtime[Date])=MONTH(B$2))*(Downtime[Machine]=B$3)*(Downtime[Category]=$A4)*Downtime[Minutes Down])

    You could also use an array formula like this, entered using Ctrl-Shift-Enter:

    =SUM(IF(MONTH(Downtime[Production Day])=MONTH(B$2), IF(Downtime[Machine]=B$3,IF(Downtime[Category]=$A4,Downtime[Minutes Down]))))

    Was this answer helpful?

    0 comments No comments