szita2000
Board Regular
- Joined
- Apr 25, 2012
- Messages
- 100
- Office Version
- 365
- Platform
- Windows
Hi Guys.
It is Friday, and yay for that but for the love of god I can't work this one out.
I am trying to crunch some reporting data from a htm file.
The bit I'm stuck is that I have a Variant declared, which starts it's life out as a string (due to a comma as a decimal in the data)
But then I use worksheetfunction.substitute to replace this with a decimal and that converts it into a Variant/Long Datatype.
When I do some calculus with these values (one divided by the other) I expect to see a 0.000 result.
However excel returning This in the immediate window for me:
On the 28 day, Machine A01 - PRCalc = 0.98366048
On the 28 day, Machine A01 - PDTCalc = 5.41666666666667E-03
On the 28 day, Machine A01 - UPDTCalc = 1.09228533333334E-02
The bold bits should read 0.54% and 1.09%
Here is the piece of code doing the simple calculation
Then I tried this:
But the results are the same.
How can I divide these numbers to show percentages?
Any help much appreciated.
Thanks
Thomas
Let me know if you need it, I can post the whole code (which is admittedly a bit clunky...
)
It is Friday, and yay for that but for the love of god I can't work this one out.
I am trying to crunch some reporting data from a htm file.
The bit I'm stuck is that I have a Variant declared, which starts it's life out as a string (due to a comma as a decimal in the data)
But then I use worksheetfunction.substitute to replace this with a decimal and that converts it into a Variant/Long Datatype.
When I do some calculus with these values (one divided by the other) I expect to see a 0.000 result.
However excel returning This in the immediate window for me:
On the 28 day, Machine A01 - PRCalc = 0.98366048
On the 28 day, Machine A01 - PDTCalc = 5.41666666666667E-03
On the 28 day, Machine A01 - UPDTCalc = 1.09228533333334E-02
The bold bits should read 0.54% and 1.09%
Here is the piece of code doing the simple calculation
Code:
'PRCalc calculation
If T > 1 Then
PRCalc = (U2 * A) * 1
Else
PRCalc = PR
End If
'PDT calculation
PDTCalc = PDT / SPP
'UPDT calculation
If T > 1 Then
UPDTCalc = 1 - ((PDT / SPP) + PRCalc)
Else
UPDTCalc = 1 - PRCalc - PDTCalc
End If
Then I tried this:
Code:
'PRCalc calculation
If T > 1 Then
PRCalc = (U2 * A) * 1
Else
PRCalc = PR
End If
'PDT calculation
PDTCalc = (PDT / SPP) [B][COLOR=#ff0000]/ 100[/COLOR][/B]
'UPDT calculation
If T > 1 Then
UPDTCalc = (1 - ((PDT / SPP) + PRCalc)) [B][COLOR=#ff0000]/ 100[/COLOR][/B]
Else
UPDTCalc = (1 - PRCalc - PDTCalc) [COLOR=#ff0000][B]/ 100[/B][/COLOR]
End If
But the results are the same.
How can I divide these numbers to show percentages?
Any help much appreciated.
Thanks
Thomas
Let me know if you need it, I can post the whole code (which is admittedly a bit clunky...