Sum fields on Wednesday

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

Does anyone know how to sum up values in a field that are on a certain day
only. For example: I have a table with two fields, one field is called "Oil"
and the other is "Date". I want to get the sum of all the Oil records that
were on a Wednesday.

Thanks,
Chris
 
Date is a bad name for a field since it is the name of a function.

However, try an expression like:
=Sum( Abs(WeekDay([Date]) = 4) * [Oil])
 
Thanks, Duane It worked perfectly.

-Chris

Duane Hookom said:
Date is a bad name for a field since it is the name of a function.

However, try an expression like:
=Sum( Abs(WeekDay([Date]) = 4) * [Oil])

--
Duane Hookom
MS Access MVP


Chris said:
Hi everyone,

Does anyone know how to sum up values in a field that are on a certain day
only. For example: I have a table with two fields, one field is called
"Oil"
and the other is "Date". I want to get the sum of all the Oil records
that
were on a Wednesday.

Thanks,
Chris
 
Hello Chris.

Chris said:
Does anyone know how to sum up values in a field that are on a
certain day only. For example: I have a table with two fields, one
field is called "Oil" and the other is "Date". I want to get the sum
of all the Oil records that were on a Wednesday.

=Sum(Iif(Weekday([Date])=4,[Oil],0))
 
Back
Top