Change formula for each new month

G

Gerry

As the month changes I need to change the formula

This is the formula, which works fine for the first month;

L1766=IF($A1766=(EOMONTH($A1766,0)),G1766,$G$1736+SUM($H$1736:H1766))

But when I change months, I need the $1736 to change, in this case to
$1767

L1767=IF($A1767=(EOMONTH($A1767,0)),G1767,$G$1736+SUM($H$1736:H1767))

TIA

Gerry
 
S

skaggsj

In plain english, it looks like this formula does this:
If A is the last day of the month, then show the value in G, if not,
then add the value in G for the first day of the month to the sum of
the values in H for the entire month.

If that's correct, you should be able to use the following formula:
{=IF($A1767=EOMONTH($A1767,0),G1767,SUM(($A1700:A1767=EOMONTH(A1767,-1)+1)*$G1700:G1767)+SUM((MONTH($A1700:$A1767)=MONTH(A1767))*$H1700:H1767))}

This is an array formula, so you don't have to type in the curly
brackets. Just press Ctrl + Shift + Enter after you type in the
formula and Excel puts the brackets around it.

Hopefully, this is what you were looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top