Adding a date

Copper Contributor

Was wondering if there was a way to add a date. So lets say I don't want it to generate a sum unless it is for a specific date or for specific days in the week. Is it possible?

1 Reply

@Matthew_morales 

Let's say you have dates in A2:A100 and corresponding values in B2:B100.

 

1) To sum the values for a specific date:

Enter that date in D2.

In E2, enter the formula

 

=SUMIFS(B2:B100, A2:A100, D2)

 

2) To sum values for a range of dates:

Enter the first date to include in D2 and the last date in E2.

In F2, enter the formula

 

=SUMIFS(B2:B100, A2:A100, ">="&D2, A2:A100, "<="&E2)

 

3) To sum values for a specific day of the week:

Enter the number of the weekday in D2, with 1=Sunday, 2=Monday, etc.

In E2, enter the formula

 

=SUMPRODUCT(B2:B100,--(WEEKDAY(A2:A100)=D2))

 

4) To sum values for a a range of days of the week:

Enter the number of the first weekday to include in D2, and that of the last weekday in E2, with 1=Sunday, 2=Monday, etc.

In F2, enter the formula

 

=SUMPRODUCT(B2:B100,(WEEKDAY(A2:A100)>=D2)*(WEEKDAY(A2:A100)<=E2))