Spreadsheet Help: Adding Multiple Rows With "If" Function

190 Views Asked by At

I'm trying to find the sum of all prices of the items on the list, minus the ones that have not sold in one cell on a spread sheet.

This Function works fine, but it takes a while to type, if you have like 20 items listed.

=IF(D3="y";E3;0)+IF(D4="y";E4;0)+IF(D5="y";E5;0)+IF(D6="y";E6;0)+IF(D7="y";E7;0)+IF(D8="y";E8;0)

I've Tried:

=IF(D3:D10="y";SUM(E3:E10);0)

But it doesn't work. I'm using OpenOffice. I would post a picture, but no rep points.

2

There are 2 best solutions below

0
Michael On

Use SUMIF:

=SUMIF(D3:D10;"y";E3:E10)

Syntax:

SUMIF(test_range; condition; sum_range)

0
gorion83 On

I think you should use SUMPRODUCT. OO guide

Specifically

SUMPRODUCT(D3:D10="y"; E3:E10)