Link to home
Start Free TrialLog in
Avatar of rjfields
rjfieldsFlag for United States of America

asked on

Question about Sumproduct Function

Hi Experts,

The function below attempts to use Trim function on a range name so that I can indent the referenced cell (the range has no indents). It fails as soon as I add a space to the name in A11.

In another case I tried to extract the year from a date by using the Year function in a similar way to what you see below. That also failed and I had to create a new column in the data.

=SUMPRODUCT(-(TRIM(tblSalariesName)=$A11),-(tblSalariesYear=B$3),(tblSalariesAmount))

I admit to being a Lotus 1-2-3 user when I can be wherein all of this is quite simple and elegant.

Thanks for any help and have a happy new year
ASKER CERTIFIED SOLUTION
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rjfields

ASKER

Thank you very much.

It turns out I made a hugely lame mistake misplacing the Trim function. OY! I caught it looking at your example. Also, you are right about the unary operator. I had an even number of them otherwise one needs to use a double unary (--) operator.

12/27
I did try to cut and paste your suggestion for the Year function above after redefining the range to exclude the column header. I also shortened the range to 10 rows and verified that I had valid dates within it. I still get #value as a return complaining about a datatype error.

12/28

Indeed you were correct about the header in the range definition causing the #value error. I just needed to take the additional step of adjusting all the other relevant ranges to omit the header cell as well to preserve the symmetry of the query.

Again thanks much