Hello Pachyderm,
There are a few possible solutions for this question, but the simplest
is with an "array formula" (search Excel help with that phrase for an
explanation). The array formula is entered by holding a modifier key
(CTRL on a Windows PC) when entering the formula - the Excel help
explains this more fully. For example:
copy / paste the formula below into cell A2
instead of clicking the check mark (or the enter key), use
CTRL-check mark or CTRL-Enter
If done incorrectly, you will get an incorrect result (or #ERR,
depending on Excel version). If done correctly, the formula will
display with braces { } around it and the correct result will appear.
For the values you provided (B1 through B4, C1 through C4), the
formula in A2 should be:
=SUM(IF(B1:B4<A1,C1:C4,0))
which will appear as
{=SUM(IF(B1:B4<A1,C1:C4,0))}
after entering as an array formula. Using today's date and the data
you provided, A2 is calculated to be 1250. I tested the formula with a
variety of values of A1 from 3/1/06 to 1/1/07 and it produces correct
results.
To change the number of cells calculated (say - B1 to B10, C1 to C10),
the formula should change to:
=SUM(IF(B1:B10<A1,C1:C10,0))
As a suggestion, I recommend you leave a blank row after the data you
use for calculation. That way, you can insert rows (for more data)
above the blank row and the formula should update automatically.
Good luck with your work. Please make a clarification request if you
are having difficulty with this solution to your problem.
--Maniac |