|
Home > Archive > MCSD > June 2002 > Visual Basic.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| tsigam 2002-05-31, 12:37 pm |
| If anyone know VB, Please help me write the calculations in VB. I have created the inetrface for the program, I'm having a hard time coding the calculations so that it displays the percentage for each soft drink brand.
The problem is to find the advertising expenditure percentage for each soft drink, cola-cola and Pesi for 1995 and 1996 Expenditure and display the percentage for each.
1995 Cola-cola=$60.7 and 1996=$121.6
1995 Pepsi-cola=$94.8 and 1996=$83.0
the book says to use this formula to caculate:100 *([1996 expenditure]-[1995 expenditure])/1995 expenditure.
please help!!!!! | |
| nikolayv 2002-06-03, 7:43 pm |
| Hello,
I suppose you need compare value of Coca-Cola and Pepsi-cola for your interested period.
For that you need just divide one number by other and result times on 100.
For example:
1995: Coca-Cola/Pepsi*100 => 94.8/60.7*100
1996: Coca-Cola/Pepsi*100 => 121.6/83.0*100
That means Pepsi-Cola sold 100% of their products, and result shows as many Coca-Cola sold compare to Pepsi in percent.
Good luck,
Nikolay | |
| RichardJW 2002-06-04, 3:38 pm |
| Private Sub Form_Load()
MsgBox CalcExpenditure(60.7, 121.6) & "%"
MsgBox CalcExpenditure(94.8, 83) & "%"
End Sub
Private Function CalcExpenditure(ByVal y1 As Long, ByVal y2 As Long) As Long
CalcExpenditure = 100 * (y2 - y1) / y1
End Function
Are you sure you are an MCSD? |
|
|
|
|