NEED MACRO TO GET BALANCE

K

K

Hi, Please see the detail below which i got on my spreadsheet

# A B C D---------Coloumns
1 100---------------------------------Budget Amount in Cell A1
2 G1 20 10-----------------Data from Cell A2 to C6
3 30 03
4 SS 15
5 13 14
6 TT 18 19

i want macro to calculate balance in coloumn D cells. the Balance
should be calculated the
way that it should minus first coloumn C figure and if there is no
figure in coloumn C then it
should minus coloumn B figure but if there is code in coloumn A cell
then it should not minus
any of that row figure and should put text in coloumn D cell that "NOT
CORRECT" and then
carry on down to the next cell
FOR EXAMPLE: in row 2 there is code "G1" in cell A2 and figure 20 in
cell B2 and also figure
10 in cell C2. now macro should check that if there is nothing in cell
A2 then it should minus
first cell C2 figure but if there is nothing in cell C2 then it should
look in cell B2 and minus that
figure and give the balance in cell D2. but as above i have code "G1"
in cell A2 so now macro
should not minus any figure which are in cells C2 and B2 but just put
text in cell D2 that
"NOT CORRECT". and like this macro should carry on working down to
next cell.
Note: that if there is nothing in cell C2 and B2 then cell D2 should
show nothing.
I hope i done my best to explain what i am trying to say and achive.
If any of my online
friend can come up with any formula in coloumn D cell that will be
also good but please
make sure that it should do all the work which i mentioned above.
Please if anybody can
give his precious time to sort out my this problem then i'll be very
thankful
 
D

Dave D-C

I think this is what you want:

=IF(AND(B2="",C2=""),"",IF(A2<>"","NOT
CORRECT",IF(C2<>"",$A$1-C2,$A$1-B2)))

Give PaulR the credit -- he had it 3 or 4 threads ago.
 
K

K

I think this is what you want:

=IF(AND(B2="",C2=""),"",IF(A2<>"","NOT
CORRECT",IF(C2<>"",$A$1-C2,$A$1-B2)))

Give PaulR the credit -- he had it 3 or 4 threads ago.












- Show quoted text -

Thanks Dave i done little adjustment in your formula and i got what i
wanted. Thanks to Paul R as well for his help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top