# Sumif with 2 conditions

#### emmieh

##### New Member
Good afternoon,

I need to sum the values in row 22 with conditions in two other rows (5 and 6). I have this formula, but it does not work:
=SUM(IF(E\$5:CZ\$5="1";IF(E\$6:CZ\$6="LCPE*";E\$22:CZ\$22;0);0))

Row 5 is 0 or 1 and the condition is 1. Row 6 is a combination of the text LCPE and a number, so LCPE001, LCPE002 etc. The condition in row 6 is that the first four letters of the cell are LCPE. A LEFT function does not work for this. Does anybody know how to solve this?

thank you!

### Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

#### MrKowz

##### Well-known Member
Why do you have quotes around the 1 in the first condition? Are those values stored as a string or a number?

=SUMPRODUCT(--(E\$5:CZ\$5=1),--(LEFT(E\$6:CZ\$6,4)="LCPE"),E\$22:C\$Z22)

#### emmieh

##### New Member
Thanks, that works!

Replies
3
Views
695
Replies
12
Views
241
Replies
3
Views
324
Replies
1
Views
166
Replies
3
Views
84

1,191,584
Messages
5,987,490
Members
440,097
Latest member
Wint

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back