adding dependent upon date

L

Legacy 15162

Guest
I am trying to add up values that occured during a week. For example, all orders placed for the week ending May 16th (so, the May 10-16).
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
txksa said:
I am trying to add up values that occured during a week. For example, all orders placed for the week ending May 16th (so, the May 10-16).

Try something like,

=sumproduct((range>=a1)*(range<=a2),range to sum)

where a1 and a2 houses the dates
 
Upvote 0
i actually went this route:

{=SUM(IF($A$3:$A$33<=(firstWeekEnd(Month)),(B$3:B$33+U$3:U$33)))}
 
Upvote 0
Function firstWeekEnd(mnthSelected As String) As Date
firstWeekEnd = firstDay(mnthSelected)
dayOfWeek = Weekday(firstWeekEnd)
While dayOfWeek <> vbFriday
firstWeekEnd = firstWeekEnd + 1
dayOfWeek = Weekday(firstWeekEnd)
Wend

End Function
 
Upvote 0
I wasn't asking for code... :confused:

If this udf computes a scalar (a date), how is it supposed to fit your question "I am trying to add up values that occured during a week. For example, all orders placed for the week ending May 16th (so, the May 10-16)."?
 
Upvote 0
it's modified for those slightly for the other dates but it does the job.

{=SUM(IF($A$3:$A$33>$A40,IF($A$3:$A$33<=$A41,(B$3:B$33+U$3:U$33))))}

Btw, sorry about posting the code.
 
Upvote 0
txksa said:
it's modified for those slightly for the other dates but it does the job.

{=SUM(IF($A$3:$A$33>$A40,IF($A$3:$A$33<=$A41,(B$3:B$33+U$3:U$33))))}

Btw, sorry about posting the code.

In case you're curious...

=SUMPRODUCT(($A$3:$A$33>$A40)*($A$3:$A$33<=$A41)*(B$3:B$33+U$3:U$33))

which is normally entered. Note that both formulas would not tolerate any text values like formula-blanks ("") in the ranges to sum.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,336
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top