View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default VLookup If Date is equal to the Day

You can use the =SUMIF() function.

Convert your numbers into excel dates (type in the date that is represented
by "1", and drag down 365 cells, Excel will fill in the dates for you (I'm
assuming you were accurate when you said there is a number for EVERY day in
the year). You can do this in another column - we'll say column C.

=SUMIF(C:C,WEEKDAY(C1),B:B)

This will give you the result for whatever day of the week cell C1 is If
your day "1" is not Monday, have your "WEEKDAY()" function look to any day
that IS a Monday in your list and you will get the total for all Mondays.
Repeat this for each day of the week you want added to the total. This'll
work as long as you keep in mind the reference in the WEEKDAY() function
points to the day of the week to be totalled. In the end you'll have the
formula above in seven cells where the WEEKDAY() function will reference
cells for each day of the week (I'm assuming it will be C1, C2, C3, or C2,
C3, C4 etc.

Hope I didn't confuse you . . . .


"dandiehl" wrote:

I have a list that contains a number for each day of the year. Column A
contains the date and column B has the corresponding number of widgets. I
would like wrtie a formula that will return the year-to-date average number
of widgets by day. It might appear like this:

Day Avg Widgets
Sun 45
Mon 215
Tue 246
Wed 302
Thu 285
Fri 177
Sat 96