Summing a range of cells

I would like to sum a range - for example:

…A…B

1.John 1
2.Paul 2
3.Sue 1
4.Sue 3

sum(column B where column A = Sue) giving result 4
sum(column B where column A = Paul) giving result 2

Looks a bit like SQL really.

The only way I can think of getting round this is to create a “name” for each set of values in column A then sum(sue), sum(Paul) etc. This is a lot of work and it’s horrible to use.

Edit:
I have found that /Data/Define Range works a lot better for defining ranges, although it doesn’t do the selection.

Is there a practical way of doing this?

=SUMIF(A1:A4;“Sue”;B1)

Mariosv - This looks like the right sort of thing, I’m trying it now.

Works perfectly - amazing you’ve saved me hours of frustration! I assume it’s not necessary to put the range in the second part because it must match the first part, you are just telling which column to look at.