|
-
Oct 8th, 2003, 12:53 PM
#1
Thread Starter
Hyperactive Member
easy question
if I have two numbers, a previous number and a current number. What formula would I use to find out the percentage difference between the two numbers.
I did try and use (previous - current) * 100 / previous but it doesn't always work.
any ideas.
this should be easy.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Oct 8th, 2003, 02:20 PM
#2
Frenzied Member
the percentage difference between what numbers?
if the numbers are from 1 to 100 or something then yea, but you cant really take a percentage differnce of 2 numbers unless theres a specific range
NXSupport - Your one-stop source for computer help
-
Oct 8th, 2003, 02:26 PM
#3
Thread Starter
Hyperactive Member
example.
previous number is 500, current number is 550.
What is the percentage change between these 2 numbers.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Oct 8th, 2003, 02:51 PM
#4
CN = (CN/PN)*PN
PN = (PN/CN) * CN
So CN = 100*(CN/PN)% of PN
and
PN = 100*(PN/CN)% of CN
Now, with CN = (CN/PN)*PN, I would say that
PN changed by 100*((CN/PN) - 1)% to become CN.
Which can be seen by
PN + change = CN
if we say that change = ((CN/PN)-1)*PN then
PN + ((CN/PN)-1)*PN is indeed = CN
So, PN to CN does indeed change by 100*((CN/PN)-1)% of PN.
-Lou
Last edited by NotLKH; Oct 8th, 2003 at 03:52 PM.
-
Oct 8th, 2003, 05:47 PM
#5
Thread Starter
Hyperactive Member
Last edited by cajsoft; Oct 8th, 2003 at 05:52 PM.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Oct 8th, 2003, 06:12 PM
#6
I didn't check his logic, but I'm sure it's accurate.
100*((CN/PN)-1)% of PN = 100*((Current Number/Previous Number)-1) = The percent the Current Number differs from the Previous Number
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Oct 10th, 2003, 04:44 AM
#7
Hyperactive Member
Maybe he wants PN as a percentage of CN?
Wouldn't that be a simple (CN / PN) * 100?
If PN = 500, and CN = 550, then CN is 110% of PN.
-
Oct 10th, 2003, 09:38 PM
#8
Basically, thats exactly what Lou (NotLKH)'s code does, except it subtacts 1 (100%), making it x percent more than the first number instead of x percent of the first number, although you're exactly right about what you're saying.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|