# Add difference to one of two chosen cells

#### Mr_GZ

##### New Member
I have a debit and a credit column. If one cell in debit is lager than a cell in credit than I would like excel to calculate the difference and add the difference in a cell in the correct row.
For example:

Column A Column B
====== ======
Debit Credit
299,9 300
0,1

Column B contain 10 cent more than column A.
Excel shall then add 0,1 in a cell below 299,9.
If Column A would contain a larger sum then excel should add the difference to the cell below column b. The row will be fixed. All excel have to do is to know what column to add the difference in.

Mr_GZ

### Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

#### Peter_SSs

##### MrExcel MVP, Moderator
If the row is fixed, then maybe you can do it like this?

Excel Workbook
ABC
1DebitCredit
2299.90300.00
30.10
4
Debit Credit

#### Mr_GZ

##### New Member
Sorry I am getting a #Value! Error. I am sure it is due to I simplified what I wanted out of the formula.
Column B contains one cell with a value for the calculation and Column B ten. The cell with the difference will always be on the row blow the last value under column A - . It is fixed this way.

This is how the formula looks like that I get the error off,
Code:
``=IF(A8:18<B8:B18;B8:B18-A8:A18;"")``
And then there is the formula for the other way around.

#### Mr_GZ

##### New Member
I had to do it like this to get it to work
Code:
``=IF(SUM(A8:18)<SUM(B8:B18);SUM(B8:B18)-SUM(A8:A18);"")``

Replies
3
Views
750
Replies
1
Views
671
Replies
1
Views
351
Replies
2
Views
491
Replies
1
Views
357

1,191,168
Messages
5,985,056
Members
439,936
Latest member
BSR

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