Division returns whole number (1 Viewer)

Russ

New member
Local time
Today, 05:00
Joined
Jan 26, 2000
Messages
5
I am trying to do simple maths in VBA but getting whole answers even when the field it is reporting to states otherwise.

Field Values are

Q1_Diff (displayed as a percentage, decimal is set at 3)
Q1_Actual (displayed as a currency, decimal set at 2)
Q1_Budget (displayed as currency, decimal set at 2)

Q1_Actual is based on total sales from 3 months which in turn are added together.

Q1_Budget is based on the yearly budget figure divided by 4.

Q1_Diff is a percentage based on the difference between Actual and Budget.

When the yearly budget figure is divided the values go right down to the last decimal point which is great.

When trying to work out the percentage difference I only get a whole number

Me.Q1_Diff = ((Me.Q1_Actual - Me.Q1_Budget) / Me.Q1_Budget)

Why is it doing this?:confused:
 

R. Hicks

AWF VIP
Local time
Yesterday, 23:00
Joined
Dec 23, 1999
Messages
619
I would think the result would have to be divided by 100 to get it to a percenatage (or multiply by .1).

So try:

Me.Q1_Diff = ((Me.Q1_Actual - Me.Q1_Budget) / Me.Q1_Budget) /100

Or:

Me.Q1_Diff = ((Me.Q1_Actual - Me.Q1_Budget) / Me.Q1_Budget) * 0.1

HTH
RDH
 

Users who are viewing this thread

Top Bottom