# Excel – Conditonal sum in Excel

libreoffice-calcmicrosoft excelopenoffice-calc

I would like to write the formula (in OpenOffice, but I imagine it won't be any different than Excel) to perform the following calculation:

-> Go through the values in column B from B1 to B30 and add them together.
-> Only include the individual number Bn in the sum if An == "value".

So, I want to create a sum of column B but only include the numbers in the sum if their corresponding A column value is some "value".

#### Best Answer

Sounds like you could use SUMIF, e.g.

=SUMIF(A1:A30,"value",B1:B30)