# IF to subtract multiple rows based on other cells contents

#### Kurtin

##### New Member
Heya,

So I have a total amount, which is the sum of a column, but I now want to have a cell for leftover amount. I am wondering how to subtract the amounts from the total based on if another cell says yes or not.

I attempted a formula but that just resulted in a #SPILL! error, which spans the same amount of cells that is listed in the \$amount column. If anyone has any other formulas that could work, or a way to fix this one it would be greatly appreciated. Thank you in advance!!

RevHappy Expenses Tracker.xlsx
DEFGH
1TOTAL \$ AMOUNT\$ 100.00\$ AMOUNT OWED REMAINING#SPILL!
2QTYDATE OF PURCHASE\$ AMOUNTPAID (YES/NO)DATE PAID
3\$ 20.00 yes
4\$ 20.00
5\$ 20.00
6\$ 20.00
7\$ 20.00
EXPENSES
Cell Formulas
RangeFormula
F1F1=SUM(Table1[\$ AMOUNT])
H1H1=IF(Table1[PAID (YES/NO)]="YES",F1-Table1[\$ AMOUNT],"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:H7Expression=\$G3=""textNO
A3:H7Expression=\$G3="YES"textNO

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

#### Eric W

##### MrExcel MVP
Try:

Book1
DEFGH
1TOTAL \$ AMOUNT100\$ AMOUNT OWED REMAINING80
2QTYDATE OF PURCHASE\$ AMOUNTPAID (YES/NO)DATE PAID
320yes
420
520
620
720
Sheet5
Cell Formulas
RangeFormula
F1F1=SUM(Table1[\$ AMOUNT])
H1H1=F1-SUMIF(Table1[PAID (YES/NO)],"yes",Table1[\$ AMOUNT])

#### Kurtin

##### New Member
Try:

Book1
DEFGH
1TOTAL \$ AMOUNT100\$ AMOUNT OWED REMAINING80
2QTYDATE OF PURCHASE\$ AMOUNTPAID (YES/NO)DATE PAID
320yes
420
520
620
720
Sheet5
Cell Formulas
RangeFormula
F1F1=SUM(Table1[\$ AMOUNT])
H1H1=F1-SUMIF(Table1[PAID (YES/NO)],"yes",Table1[\$ AMOUNT])
Worked PERFECTLY thank you so much! I understand where I went wrong

#### Eric W

##### MrExcel MVP
Happy to help! Thanks for the feedback.

Replies
0
Views
134
Replies
2
Views
69
Replies
6
Views
79
Replies
1
Views
280
Replies
1
Views
170

1,127,865
Messages
5,627,344
Members
416,242
Latest member
Kas O

### 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