One thing I can’t understand is the failure of L16 to produce the result of number of hours worked in a month. It appears to work fine in L15 so why not in L16?
I believe I explained that adequately.
I wrote: ``
the formula in L16 does not work because H16 is the null string (""). In Excel,
all dates (numeric values) are less than any text, including the null string.
So the first condition is always FALSE (except for rows 5:7, where column B is empty; Excel treats the empty cell as equal to the null string). Consequently, SUMIFS returns zero.``
In contrast, I wrote: ``In Excel,
all dates are greater than any time (less than 24 hours). That is
why the formula in L15 appears to work insofar as it returns some numeric value. It happens to be the correct numeric value. But
that is only a coincidence due to the fact that J15 (starting date) is the same as the earliest date in column B.``
But based on your intent described below, I question whether the value in L15 is indeed "correct" (i.e. what you should expect).
My concept [... is ...] to sum these tasks into a monthly activity according to the cutoff date which occurs near the end of the month. The cutoff dates change each month hence the need for column k.
What do you mean by "month"? Calendar month of the cutoff date (e.g. Dec)? 4-week period ending with cutoff date? 30-day (31? 28? 29?) period ending with cutoff?
Provide the start and cutoff dates that you intend for the L15 and L16 calculations.
And provide the values in L15 and L16 that you expect, by summing the applicable times in column H manually.
-----
Why not use column J in the first SUMIFS condition, as I demonstrated? Column J is titled "Start of Mth".
And for L15, why is the "month" effectively from 11/10/2017 to 12/19/2017 (K15)?
That is 39 days. For any of my definitions of "month", L15 would be 43.5, not 50.
On the other hand, I note that J16 is 12/20/2017. Does each "month" start on the day following the previous cutoff date?
The bottom line is as I wrote before: perhaps the SUMIFS expression should be ``SUMIFS(H:H, B:B, ">=" &
J16, B:B, "<=" & K16). In that case, L16 would result in 39.5``.
Why isn't that the correct answer?
Alternatively, the SUMIFS expression might be one of the following, based on my definitions of "month" above.
Same calendar month as the cutoff date:
SUMIFS(H:H, B:B, ">=" &
EOMONTH(K16,-1)+1, B:B, "<=" & K16)
4-week period ending with the cutoff date:
SUMIFS(H:H,B:B,">="&
K16-28, B:B, "<=" & K16)
30-day period ending with the cutoff date:
SUMIFS(H:H,B:B,">="&
K16-30, B:B, "<=" & K16)