# Formula to add values based on the date range.

how can i sum based on the given date range.
EE.xlsx
LVL 6
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
You are mixing date formats in the date range column, can that be corrected to always use the same format?  Otherwise the formula won't know how to interpret something like 01/06/2017, it will have no way of knowing if this is in MM/DD/YYYY format, or DD/MM/YYYY format.

»bp
1
Finance AnalystCommented:
You can use a Pivot Table for that, grouping the dates into Quarters.
0
Excel & VBA ExpertCommented:
It seems you want to summarize the amount quarter wise. You can use the pivot table to achieve that.
Pls refer to the attached.
EE.xlsx
1
Commented:
Hi,

pls try
``````=SUMIFS(B:B,A:A,">="&DATEVALUE(LEFT(E2,8)),A:A,"<="&DATEVALUE(RIGHT(E2,8)))
``````
Regards
1

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
thanks. i do not want pivot tables.
i prefer sumproduct formula that i can add more condition to them.
0
Commented:
If you do adjust the dates then you can try:

``````=SUMIFS(\$B:\$B,\$A:\$A,">="&TRIM(LEFT(\$E2,FIND("-",\$E2)-1)),A:A,"<="&TRIM(MID(\$E2,FIND("-",\$E2)+1,999)))
``````

»bp
1
Finance AnalystCommented:
For a purely formula driven approach, as Bill mentions, you have to ensure that the dates are of a consistent format.

When that is corrected then the SUMIFS suggestion by RGonzo can be used for multiple conditions; currently being used with only two conditions to create the range between dates.
1
Commented:
as a sumproduct
``````=SUMPRODUCT(B:B,--(A:A>=DATEVALUE(LEFT(E2,8))),--(A:A<=DATEVALUE(RIGHT(E2,8))))
``````
1
Author Commented:
thanks Rgonzo. it worked for me
0
Author Commented:
thank you very much everyone. much appreciated.
0
Author Commented:
Bill, thank you. your formula also works.
0
Author Commented:
this formula from Rgonzo is super =
``````SUMPRODUCT(B:B,--(A:A>=DATEVALUE(LEFT(E2,8))),--(A:A<=DATEVALUE(RIGHT(E2,8))))
``````
0
Author Commented:
i posted a follow up question.
0
Author Commented:
Rgonzo1971

i get value if the dates are not quarter based.

Date Ranges
01/01/18- 03/23/18
01/01/19- 03/23/19

i posted a new question.
0
Finance AnalystCommented:
Based on the format of the other dates, those dates are not valid dates. All the other dates are in "dd/mm/yy" format but the end dates for these two are not as there is not a 23rd month of the year.

If your local settings are set to recognise "dd/mm/yy" then DATEVALUE on a text string like you have with those two entries will throw an error.
1
Author Commented:
thanks Robert.  it is now working. i made a mistake. my dates are always dd mm yy and Rgonzo's formula works just fine.

thanks again for your professional help.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

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.