Excel function problem

5 years ago I'd have known this but getting rusty.

I'm using an IF function that scans a column of initials and returns the total of the values against each occurance of a particular initial, ie:

=SUMIF(B20:B339,"RS",E20:E339)

Which scans all the initials in column B and, for all the RSs it comes across, returns the total of all the values in column E.  This works fine.

However, instead of typing RS into the function, what I'd rather do is to tell it to pick the contents of another cell (containing RS).  But when I do this and substitute "RS" for "=D334" (the cell containing "RS") it doesn't work.

I'm sure there's a qualifier or something I can use to make it recognise the text contents of a cell but I can't remember.

Anybody any idea?

TIA

Comments
Steve Kesby's picture

Instead of...    1 thanks

Steve Kesby | | Permalink

..."=D334", shouldn't it just be D334?  I don't know, I haven't tried it, but it seems more intuitive to me.

Paul Scholes's picture

OMG

Paul Scholes | | Permalink

As the young folk exclaim, you're only right, thanks Steve, you've saved my hair.

shurst's picture

With comparison operators

shurst | | Permalink

The double quotes might come in if you needed to do something apart from equals, such as > or < or <>. That could be entered as "<>" & D334. The & works as the 'concatenation' operator to create the full expression incorporating the contents of D334