Hi, I want to sum values from a table I have. I try to describe it here.

This is how the table looks like.

Year Hours Injuries

2000 2 1

2001 5 2

2002 4 1

2003 9 3Under this table I have made two drop down list so I can choose "From year" to "To Year".

Under this I want to it to sum up all the values for number of "Hours" and number of "Injuries" from the years I have chosen.

I have tried to make a SUMIF function but it isn't correct. What I have written is:

SUMIF($A$3:$A$19;">"&$B$23;$C$3:$C$19) where column A is years, B is Hours and where I choose "From year", and C is Injuries and "To year". With this code it doesn't matter what I choose in "To year".I would appreciate all the help I can get :)

Regards

Does this work for you... Using your example data I put drop downs in D1 and D2 to select my years. In E1 I used this formula to get the hours:

=SUM(B2:B5) - SUMIF(A2:A5,"<"&D2,B2:B5) - SUMIF(A2:A5,">"&D3,B2:B5)

A B C D E 1 Year H I Year H 2 2000 2 1 2001 9 3 2001 5 2 2002 4 2002 4 1 5 2003 9 3

Thanks a lot DerbDad03!! It works great. Regards

Glad I could help. You could improve upon the system by making sure it doesn't give weird results if your date range is out of whack, like your end date being less than your starting date.

Let me know if you need help with that.

Hi, Do you have any suggestions to what I can do to make sure not to have weird results (like negative results) ?

Regards

Ask Your Question

Weekly Poll

Do you think Microsoft can save the Surface Book lineup?

Discuss in The Lounge

Poll History