ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How Do I Add Dates in a formula? (https://www.excelbanter.com/excel-worksheet-functions/63845-how-do-i-add-dates-formula.html)

Rogue

How Do I Add Dates in a formula?
 

I'm trying to get the sum of dollars spent in each week of the year. The
range is compiled of invoice data, with non consecutive dates. Column A
contains dates, and column G shows the corresponding dollar amounts. I
want to return the total dollars spent for the first week of the month
in cell E20. (I will end up having all the weeks of the year listed
with the dollars spent in that week.) Should this be a SUMIF function,
and how should dates be entered into the formula?


--
Rogue
------------------------------------------------------------------------
Rogue's Profile: http://www.excelforum.com/member.php...o&userid=30246
View this thread: http://www.excelforum.com/showthread...hreadid=499185


Ron Rosenfeld

How Do I Add Dates in a formula?
 
On Sun, 8 Jan 2006 12:11:06 -0600, Rogue
wrote:


I'm trying to get the sum of dollars spent in each week of the year. The
range is compiled of invoice data, with non consecutive dates. Column A
contains dates, and column G shows the corresponding dollar amounts. I
want to return the total dollars spent for the first week of the month
in cell E20. (I will end up having all the weeks of the year listed
with the dollars spent in that week.) Should this be a SUMIF function,
and how should dates be entered into the formula?


You can use SUMIF.

Let us say you have your WeekStartDates in Z2:Z54, and your range of Data goes
and Dates goes from Row2--Row1000.

The general form of the formula would be:

=SUMIF(A2:A1000,"="&Z2,G2:G1000) -
SUMIF(A2:A1000,""&Z2+7,G2:G1000)

Format the result as Currency.


--ron

Ragdyer

How Do I Add Dates in a formula?
 
One way to approach this is to enter the starting date of the first week in
say H1,
And the ending date of the first week in I1.
Then, enter the starting and ending dates of the second week in H2 and I2.

Now, select *all 4* cells, and drag down to copy, as needed.
This gives you a datalist of your weeks, which you can reference in a
formula.

Enter this formula in J1, and copy down as needed:

=SUMPRODUCT(($A$1:$A$100=H1)*($A$1:$A$100<=I1)*$G $1:$G$100)

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rogue" wrote in
message ...

I'm trying to get the sum of dollars spent in each week of the year. The
range is compiled of invoice data, with non consecutive dates. Column A
contains dates, and column G shows the corresponding dollar amounts. I
want to return the total dollars spent for the first week of the month
in cell E20. (I will end up having all the weeks of the year listed
with the dollars spent in that week.) Should this be a SUMIF function,
and how should dates be entered into the formula?


--
Rogue
------------------------------------------------------------------------
Rogue's Profile:

http://www.excelforum.com/member.php...o&userid=30246
View this thread: http://www.excelforum.com/showthread...hreadid=499185



zorvek

How Do I Add Dates in a formula?
 
Assuming your dates and dollar amounts start in row 2 (you have a header
row), the following formula, placed in cell E20, will return the sum of
sales for the first ISO week of the year. Copy the formula to cell E21 to
get the total for ISO week 2, and so on.

=SUMPRODUCT((1+INT((A$2:A$100-DATE(YEAR(A$2:A$100+4-WEEKDAY(A$2:A$100+6)),1,5)+WEEKDAY(DATE(YEAR(A$2:A $100+4-WEEKDAY(A$2:A$100+6)),1,3)))/7)=(ROW()-19))*G$2:G$100)

Note that the ranges A$2:A$100 and G$2:G$100 must match the range of
existing data. Any empty or non-numeric cells in those ranges will produce a
#NUM! error. Also note that the ranges should only span the current year.
Since the formula works with ISO week numbers, expanding to more than one
year's worth of data might include multiple years in a specific week.

Kevin

"Ragdyer" wrote in message
...
One way to approach this is to enter the starting date of the first week
in
say H1,
And the ending date of the first week in I1.
Then, enter the starting and ending dates of the second week in H2 and I2.

Now, select *all 4* cells, and drag down to copy, as needed.
This gives you a datalist of your weeks, which you can reference in a
formula.

Enter this formula in J1, and copy down as needed:

=SUMPRODUCT(($A$1:$A$100=H1)*($A$1:$A$100<=I1)*$G $1:$G$100)

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rogue" wrote in
message ...

I'm trying to get the sum of dollars spent in each week of the year. The
range is compiled of invoice data, with non consecutive dates. Column A
contains dates, and column G shows the corresponding dollar amounts. I
want to return the total dollars spent for the first week of the month
in cell E20. (I will end up having all the weeks of the year listed
with the dollars spent in that week.) Should this be a SUMIF function,
and how should dates be entered into the formula?


--
Rogue
------------------------------------------------------------------------
Rogue's Profile:

http://www.excelforum.com/member.php...o&userid=30246
View this thread:
http://www.excelforum.com/showthread...hreadid=499185






All times are GMT +1. The time now is 01:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com