# Formula for lookup, sum if and date range

#### jhampel106

##### New Member
I am looking for someone who is proficient in formulas to help me out. I am trying to match a date range and total sums if the row falls between the date range. I want to do this as a formula, not a macro. My file has three worksheets. In worksheet 'PT', column E (Line Description) lists the beginning and ending date range, but it is in text format with other characters at the end of the line, but the first 6 characters will always be beginning date and characters 8-13 will always be the ending date. Worksheet 'names' cross references the common data that will match the other two worksheets. Worksheet 'UNIV' lists all the raw data that needs to be totaled. I would like to create a formula in worksheet 'PT' where it grabs every line in worksheet 'UNIV' that falls within the date range for that customer and total it in the highlighted cell G2. Can someone help me?
Here is a link to a screen print of what I am looking at.
https://www.dropbox.com/s/j7gwpkkdis...onK12%20EX.pdf

I have been trying to work on this for quite some time and can't work out the kinks for it to give me a sum total.
Thank you.

### Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

#### gehusi

##### Board Regular
Give this one a shot:

=SUMIFS(UNIV!V:V,UNIV!B:B,INDEX(names!A:B,MATCH(PT!A2,names!A:A,0),2),UNIV!L:L,">="&DATE("20"&MID(E2,5,2),LEFT(E2,2),MID(E2,3,2)),UNIV!L:L,"<="&DATE("20"&MID(E2,12,2),MID(E2,8,2),MID(E2,10,2)))

I reconstructed the first few lines of your file based on the images. It returns -177.1 for the first entry on 'PT' (BeeBee Co., 7/29/13 - 8/5/13).

Note that I've hardcoded the "20" in the year part of the date formula, assuming that all your data occurs in this century. If there's stuff from before the year 2000 the formula will require minor adjustment to work properly.

#### jhampel106

##### New Member
It works beautifully. I knew it could be done, and I have been working on this for a long time. Thank you for your help!

1,101,810
Messages
5,483,045
Members
407,375
Latest member
achusp

### This Week's Hot Topics

• Finding issue in If elseif else with For each Loop
Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
• MsgBox Error
Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
• CELL FORMAT - IF CONDITION
My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
• Show numbers nearly the same
Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...