calculate percentage

User avatar
sal21
PlatinumLounger
Posts: 4354
Joined: 26 Apr 2010, 17:36

calculate percentage

Post by sal21 »

To be sure if i have understand...

is this code correct to calculate the 3% of this operation:

.....
'PERCENTUALE SUPERO MONETE
If strDBRows(4, I) > 0 And strDBRows(3, I) > 0 Then
MONETE = Empty
MONETE = (CLng(strDBRows(3, I) - CLng(strDBRows(4, I))) * 0.03)
End If
'PERCENTUALE SUPERO MONETE
.....

note:
strDBRows, is a prt of loop of array

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: calculate percentage

Post by HansV »

The line

MONETE = Empty

isn't necessary, you can delete it. The parentheses in the next line aren't quite right, as far as I can tell. It should be

MONETE = (CLng(strDBRows(3, I)) - CLng(strDBRows(4, I))) * 0.03

if you want to calculate 3% of the difference.
Best wishes,
Hans