# Excel 2007 - formula

My OS is win 7 prof 64 bit and I use Excel 2007.
I have not used Excel for a long time.
I am trying to write a formula.  The values will be currency format.
Say, in cols B2 is "Credit", B2 is "Debit" and C2 is the "balance."

If C3 = 100
and B4 = 90
Then the formula for C4 is required.
(Note in a row entry, there will only be a Credit or Debit entry recorded, not both, and it will never be zero or null. )
It will be like, The (balance + Credit) - Debit
I think it should be an IIF command, but I am not sure, i.e.
if the Debit is 0.0, the balance = balance + Credit
if the Debit is 5.00, and the credit is 0.00, then the balance = balance - Debit
I hope my hypothesis makes sense.  Grateful for your suggested formula for the balance please.
Thank u
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
jegajothy,

Can you upload a sample spreadsheet? Some points in your question seems to be contradicting. You were saying in Column B2 is "Credit", then you are saying B2 is Debit? How can a B2 the debit sits in the Column B which is supposed to be credit?

I assume you are saying Column A is credit, Column B is debit, and Column C is balance.

That way, you can write something like this in Column C. Let's say C3. =C2+A3-B3.

If you don't want it to show anything when there is nothing in A and C, then =If(sum(A3:B3)=0,"",C2+A3+B3)

That should get the job done.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

retiredAuthor Commented:
in response to HarryHYLee, thank u for your response.  I tried duplicating your example, but looks like I may have goofed up something that I cannot spot.
Attached is the sample file, I am sure u can spot the error in the formula.  Please let me know here or on the file where the error is.  Thank u.
formula.xlsx
0
Commented:
Try this formula in C3

=C2+A3-B3

regards, barry
0
Commented:
jegajothy,