ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If statements in Excel (https://www.excelbanter.com/excel-discussion-misc-queries/169918-if-statements-excel.html)

joel

If statements in Excel
 
Hi to all

Is there anyway of write a VBA script for a cell that says If for example on
sheet3 what ever b2 has in it add to b2 in sheet1 or or what ever is in
sheet3 B1 subtract ii from b2 on sheet1


I have tried and failed it is driving me barmey
--
N/A

Bob Phillips

If statements in Excel
 

With Worksheets("Sheet1").Range("B2")
.Value = .Value + Worksheets("Sheet2").Range("B2").Value - _
Worksheets("Sheet2").Range("B1").Value
End With


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Joel" wrote in message
...
Hi to all

Is there anyway of write a VBA script for a cell that says If for example
on
sheet3 what ever b2 has in it add to b2 in sheet1 or or what ever is in
sheet3 B1 subtract ii from b2 on sheet1


I have tried and failed it is driving me barmey
--
N/A




joel

If statements in Excel
 
Hi bob thanks for your help very muchy appreicated but I have confused myesel
further, maybe I can explain myself better

I have 2 sheets in my spreadsheet

Sheet 1 is called Template
Sheet 2 is called Calculation

In the Template sheet I have 2 cells of great interest "R29 Amount in"

"T29 Amount Out"


In the Calculations Sheet I have a 4 columns which perform various fuctions
and calculations

Column 1 (Full amount minus amount paid) This takes a copy of my balance
from my template sheet and adds the amount in I have paid in

Formula is =IF(Template!R29="","",(J6-Template!R29))

Column 2 (Full amount plus amount used) This takes a copy of my balance from
my template sheet and subtracts the amount in I have paid out

Formula is =IF(Template!T29="","",(J6+Template!T29))

Column 3 (Amount of monthly interest) This take a copy of my balance and
adds my monthly interest to it

Formula is =IF(D7="","",(D7*Template!T14))


Column 4 (Carried forward Balance) This is the cell I am havin great
problems with I can get it to subtract what I have paid off but I am having
problems to get it to add what I have used on it

The Formula is =IF(D7="","",(D7+H7))

In essence I am wanting it t do 2 calculations at once I want it to continue
to deduct but I now want it to add whatever I use that is why I thought VBA
woul be better but I am just stuck can you please help.

Regards Joel







--
N/A


"Bob Phillips" wrote:


With Worksheets("Sheet1").Range("B2")
.Value = .Value + Worksheets("Sheet2").Range("B2").Value - _
Worksheets("Sheet2").Range("B1").Value
End With


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"Joel" wrote in message
...
Hi to all

Is there anyway of write a VBA script for a cell that says If for example
on
sheet3 what ever b2 has in it add to b2 in sheet1 or or what ever is in
sheet3 B1 subtract ii from b2 on sheet1


I have tried and failed it is driving me barmey
--
N/A






All times are GMT +1. The time now is 03:33 AM.

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