ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with ROUND (https://www.excelbanter.com/excel-programming/341196-help-round.html)

Paul

Help with ROUND
 
Hi NG,
I would really appriciate some help with this code with a formula,
the calculation works, but I need the result to be rounded
e.g. 34.4 will result in 34
and 34.5 will result in 35.
Can anyone suggest how to modify this code to round the result?
TIA
Paul

Sub TotcalcCpy()
Application.ScreenUpdating = False
Sheets("IMPUT").Select
Range("J2").Select
Set frng = Sheets("IMPUT").Range("J2:J" &
Range("A65536").End(xlUp).Row)
With frng
..Formula = "=IF(F20,F2*H2/100,D2*I2)"
..Formula = .Value 'changes the formula to value
End With
Sheets("IMPUT").Select
Range("A1").Select

Application.ScreenUpdating = True
End Sub


Paul

Help with ROUND
 
By the way, I forgot to mention I'm using Excel 2003 on Windows XP.

TIA
Paul


Gary Keramidas[_4_]

Help with ROUND
 
if you want to round both results, try this

ROUND(IF(F20,F2*H2/100,D2*I2),0)

--


Gary


"Paul" wrote in message
oups.com...
By the way, I forgot to mention I'm using Excel 2003 on Windows XP.

TIA
Paul




Paul

Help with ROUND
 
Gary,
Thanks very much, that worked far simpler than I expected.
I was playing around with application.worksheetfunction.round
and was getting no where.
Thanks again.

Cheers Paul


Gary Keramidas wrote:
if you want to round both results, try this

ROUND(IF(F20,F2*H2/100,D2*I2),0)

--


Gary




All times are GMT +1. The time now is 01:19 AM.

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