Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

I have attached a spreadsheet that shows start and stop dates for certain volume targets (column I) by customer number (column A). Some records are only one month total, others are many.

I need to take this information and condense it down to ~500 records starting in column M, that shows the customer volume for each month. so for the first record on row 2, I need a formula that says to vlookup M2, then if the records in A2 through I14,000 has a date between columns F & G, then take the volume amount from column I and display. Not sure if you can combine a VLOOKUP and a date between function, but that is what I'm trying to accomplish. Thanks in advance. Book2.xlsx

I need to take this information and condense it down to ~500 records starting in column M, that shows the customer volume for each month. so for the first record on row 2, I need a formula that says to vlookup M2, then if the records in A2 through I14,000 has a date between columns F & G, then take the volume amount from column I and display. Not sure if you can combine a VLOOKUP and a date between function, but that is what I'm trying to accomplish. Thanks in advance. Book2.xlsx

I put this formula in L2 copied down to L507 (hide if required or move somewhere else)

=COUNTIF(A:A,M2)

and then this formula in N2 copied across and down to AB507

=LOOKUP(N$1,INDEX($F$2:$F$

That could be shortened using OFFSET but the formula would probably be less efficient

Note: I formatted columns F and G as dates - that isn't strictly necessary but it won't affect the formula

see attached

regards, barry

27328856.xlsx

=VLOOKUP(N$1,INDEX($F$2:$F

see revised attachment

I note that there are some #N/A errors further down (because the date ranges for some codes don't start until 2011). If you want the formula can be modified to show zero, e.g. with IFERROR

=IFERROR(VLOOKUP(N$1,INDEX

barry

27328856v2.xlsx

=SUM($I$2:$I$15000*($A$2:$

Few points...

(1) Barry and I have, I think, differed in our handling of multiple entries matching the criteria. In any event, I have pasted Barry's values (from his first file) starting in column M and highlighted the differences in red.

(2) You mentioned row 14,000 as being the last to check, but there are a number of rows beyond that. Like Barry, I assumed that this was a misprint and used 15,000 instead.

(3) My formulas must be entered as array formulas so use Ctrl+Shift+Enter rather than simply Enter.

Regards,

Brian.

Book2-V4.xlsx

The FormulaMeister's "SumIfs" is definitely the way to go - my "Sum" is an absolute dog (coming from an old dog, perhaps?).

Nice one Barry!

Regards,

Brian.

regards, barry

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

Well spotted Brian - I picked up the #N/As, of course, which could be fixed with IFERROR as I suggested but there are some other discrepancies that I didn't notice.

Perhaps unwisely I didn't consider that there might be multiple entries matching the criteria.......

My VLOOKUP type approach finds a single value, whereas Brian's summing approach, as he says, will sum column I for all matching rows - the discrepancies come when there are overlapping date ranges - because of the nature of VLOOKUP with a missing 4th argument (equivalent to setting to TRUE) this means that the second entry is taken when there are two matches, e.g. for rows 6968 and 6969 where the date ranges overlap my suggestion takes the second entry which is zero. I assume that summing works in this case because it appears that there is always one entry with a zero and one non-zero, perhaps that wouldn't be legitimate if there were two equal non-zero values?

For the same results as Brian SUMIFS should be considerably more efficient in Excel 2007, i.e. with this formula

=SUMIFS($I$2:$I$15000,$A$2

regards, barry