vLookup with dates


Jodi Macy

I have the raw data below where I would like to 'average' for September, the
combined total in the last three columns for any particular agent.
Is vLookup the correct funtion for this?

Agent Submit Time Attitude Aptitude Experience
Zoumadakis, Steven 07/29/08 09:12 AM 5 5 5
Zoumadakis, Steven 08/05/08 05:07 PM 5 5 3
Zoumadakis, Steven 08/07/08 09:06 AM 5 5 5
Zoumadakis, Steven 08/07/08 03:24 PM 5 4 5
Zoumadakis, Steven 08/11/08 08:08 AM 4 4 4
Zoumadakis, Steven 08/11/08 03:13 PM 5 5 5
Zoumadakis, Steven 08/12/08 02:28 PM 5 5 5
Zoumadakis, Steven 08/13/08 03:20 PM 5 5 5
Zoumadakis, Steven 08/14/08 03:13 PM 5 5 5
Zoumadakis, Steven 08/15/08 01:13 PM 5 5 5
Zoumadakis, Steven 08/19/08 07:41 AM 4 3 4
Zoumadakis, Steven 08/21/08 01:50 PM 5 5 5
Vasquez, Richard 08/11/08 09:23 AM 5 5 5
Vasquez, Richard 08/13/08 01:21 PM 4 3 4
Vasquez, Richard 08/20/08 06:56 AM 2 1 2
Vasquez, Richard 08/21/08 08:16 AM 4 3 4
Vasquez, Richard 08/25/08 09:29 AM 4 3 3
Vasquez, Richard 09/10/08 01:05 PM 5 4 5
Vasquez, Richard 09/15/08 09:04 AM 4 4 4

T. Valko

Try this array formula** :



A2:A20 are names
H2 is the name of interest
B2:B20 are dates
9 is the month number of interest (9 = September)
C2:E20 are the values to average

** array formulas need to be entered using the key combination of

Jodi Macy

I don't understand why H2 has relevance....
Also, how do I involk the "CTRL,SHIFT,ENTER (not just ENTER)" command? I've
never heard of this.

T. Valko

I don't understand why H2 has relevance....

H2 is the name of the agent that you want the average for.
how do I involk the "CTRL,SHIFT,ENTER (not just ENTER)" command?

This is an array formula. Array formulas are entered differently than a
regular formula. After you type in a regular formula you
hit the ENTER key. With an array formula you *must* use a combination of
keys. Those keys are the CTRL key, the SHIFT key and the ENTER key. That is,
hold down both the CTRL key and the SHIFT key then hit the ENTER key.

When done properly Excel will enclose the formulas in the brackets. You
can't just type these brackets in, you *must* use the key combo. Also,
anytime you edit an array formula it *must* be re-entered as an array using
the key combo.

Jodi Macy

Nevermind, I figured it out and I LOVE HOW THIS WORKS. I've been struggling
with this for awhile now. THANK YOU, thank-you, thank-you...

Jodi Macy

How would I code this to get rid of the #DIV/0! and show a dash (-) ?
I've tried a few things with no luck....


T. Valko

Depending on what version of Excel you're using...

Excel 2007 only:


All versions of Excel:


Both are array entered!


The second one worked great with my 2003 version.
Thanks again!
One more question, is this the correct way to obtain a Ytd number

And would this be the way for a particular quarter

T. Valko

For the YTD, change each instance of:




For the quarter (calendar quarter) you have to add another test. For
example, for the 1st quarter which is Jan - Mar:




And I hate to bother you one more time, but I can't seem to figure out how
to compute just October.... I tried this with no luck amongst other
criteria. I'm hopless....


T. Valko

I think you're missing the comparison test for Agents.

In logical terms you have:

If Agents....

Ok, If Agents what? You have to test Agents against some condition. For

If Agents = "some name"

....IF((Agents="Maxwell Smart")*(MONTH(SubmitDate)=10)...



Actually, I don't need the Agents at all, just a monthly number for the
month. is there a date range I need to specify?

T. Valko

Actually, I don't need the Agents at all

So, you want the average based on the sole condition that SubmitDate =



This is very awesome, I can't believe how patient you've been with me. My
job depends on it. Thank you!!!

So, my last request would be, what if I only wanted the Agents score say
from a specified daterange, like Oct 1 through Oct 8th?
I realized I needed to slice this data every which way but loose, ha!

T. Valko

For a date range...


The date boundaries can be expressed several different ways:

Using the DATE function:


Using a hardcoded date value (I personally don't like this method!):


Using cell references (this would be my preference!):

A1 = lower date boundary = 10/1/2008
B1 = upper date boundary = 10/8/2008
C1 = agent name = Maxwell Smart


And, if you want to break it out for a specific agent:


All formulas are array entered.


This all works well. Thank you.
I used your suggested method. It's better, yes because I don't need to keep
the history.
You're a dream come true.....

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question