 # Calculate Percentage in VC

Hi Community,

I have two columns:

Physical column: Total = 20,000
Virtual column: Total Declared = 5,145

I would like to create a VC with the percentage formula which at the minute I’m lead to believe is:

([Total Declared]/[Total])*100

although this formula produces a 0.00% where really I think it should be 25.7%.

Any ideas would be greatly appreciated.

Chris.

@Chris_Jeal
`([Total Declared]*100.00)/[Total]`
should do the trick

2 Likes

Spot on, thanks @LeventK

You’re very welcome

if you define the column as type = Percent, do you need to divide/multiply by 100 at all?

It seems that you do, just tried without the * and the calculation didn’t work, just left me with 0.00.

Chris.

There seems to be a bug here.

You should be able to use a Percent column and perform the raw division - “A / B”. It will then automatically convert the value to Percent and display it with the “%”.

In fact, when adding a new row or Editing a row, the VC column will calculate the value correctly.

After a sync is performed, the value reverts to zero. See images below.

Is this a known issue??

Immediately after Editing the row_____________Value goes to zero after a Sync  This issue stems from division of two Number type columns. There are two ways to still use the Percent type VC column and make the correct Percent value “stick”:

1. Re-dfine the number columns as Decimal with ZERO decimal digits. The values are treated like Numbers but are in fact Decimals.

2. Force the result in the VC to be decimal by mult one of them by “1.0” - `"A * 1.0 / B"`

EDIT: This exact issue was asked back in July but was not reported as a bug. I’ll open one for it.

Bug opened:

1 Like