ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   NEED MACRO TO GET BALANCE (https://www.excelbanter.com/excel-programming/405393-need-macro-get-balance.html)

K[_2_]

NEED MACRO TO GET BALANCE
 
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

Dave D-C[_3_]

NEED MACRO TO GET BALANCE
 
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 wrote:
I want a macro to calculate the balance in column D.
The Balance should be calculated as follows:

It should subtract the column C amount if there is one, and
if there is none then it should subtract the column B amount.
But if there is code in column A, then it should not subtract
anything but should put "NOT CORRECT" in column D.

FOR EXAMPLE:
A2 = "G1"; B2 = 20; C2 = 10

Now the macro should check that A2 has a code in it so it
should not subtract anything, but just put "NOT CORRECT" in D2.

Note that if there is nothing in cell C2 and B2 then cell
D2 should show nothing.

I hope I have done my best to explain what I am trying to
say and achive.

If any of my online friends can come up with any formula
for column D, that will be good but please make sure that it
does all the work which I mentioned above.

Please, if anybody can give his precious time to sort out
my problem then I'll be very thankful


K[_2_]

NEED MACRO TO GET BALANCE
 
On Jan 31, 9:23*pm, Dave D-C wrote:
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 wrote:
I want a macro to calculate the balance in column D.
The Balance should be calculated as follows:


It should subtract the column C amount if there is one, and
if there is none then it should subtract the column B amount.
But if there is code in column A, then it should not subtract
anything but should put "NOT CORRECT" in column D.


FOR EXAMPLE:
*A2 = "G1"; B2 = 20; *C2 = 10


Now the macro should check that A2 has a code in it so it
should not subtract anything, but just put "NOT CORRECT" in *D2.


Note that if there is nothing in cell C2 and B2 then cell
D2 should show nothing.


I hope I have done my best to explain what I am trying to
say and achive.


If any of my online friends can come up with any formula
for column D, that will be good but please make sure that it
does all the work which I mentioned above.


Please, if anybody can give his precious time to sort out
my problem then I'll be very thankful- Hide quoted text -


- 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


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com