# SUM IF Statement help

#### Special-K

##### Board Regular
I've got a statement that basically says:

(CELL AB6) ... my formula says that if either of these entries (HC, HL, HP, HE) are present in CELL A6 .... then take the value in CELL AA6 and divide it by the value in CELL F111.

My problem is: How do I get the value in AB6 to go blank/return to zero if the code that triggered it in CELL A5 is removed.

Here's the formula I have:
=SUM(SUMIF(A6,{"HC","HL","HP","HE"}),(AA6/F111))

CELL A6 ................ CELL AA6 ...............CELL AB6
HP ..........................4...............................2

(F111 = 2)

So, currently, if I remove "HP" ... the value in cell AB6 remains. And I need it to return to zero.

Thanks to all!

### Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

#### erik.van.geit

##### MrExcel MVP
Hi,

was your formula really doing what you intended (except your zero-problem) ?

this would be my suggestion
=IF(ISNA(MATCH(A6,{"HC","HL","HP","HE"})),0,(AA6/F111))

kind regards,
Erik

##### MrExcel MVP
=IF(F111,(ISNUMBER(MATCH(A6,{"HC","HL","HP","HE"},0))*AA6)/F111,0)

Thank you, Erik!

Kevin.

#### erik.van.geit

##### MrExcel MVP
seems you didn't see Aladins formula

NOTE that my formula doesn't check if F111 is zero, while Aladin's formula does !
& I think ISNUMBER is faster then ISNA
so use Aladins formula

also you didn't need the brackets (you had in your formula which I copied)
=IF(ISNA(MATCH(A6,{"HC","HL","HP","HE"})),0,(AA6/F111))
this is enough
=IF(ISNA(MATCH(A6,{"HC","HL","HP","HE"})),0,AA6/F111)

Replies
2
Views
60
Replies
1
Views
298
Replies
3
Views
199
Replies
6
Views
266
Replies
4
Views
236

1,136,272
Messages
5,674,756
Members
419,525
Latest member
helensesc

### 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.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

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

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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