You are viewing limited content. For full access, please sign in.

Question

Question

Divide Calculation without using JS

asked on June 6, 2018

Hi All,

 

I am looking at doing a calculation without the need of JS if possible? 

Basically, I have 3 fields I need to be calculated as follows:

(Quantity*Price)-(Discount%) 

Currently I have the calculation as per below:

 

=SUM(PRODUCT(INDEX(TableQuantity,ROW())*INDEX(Table.Price,ROW()))-(DIV(INDEX(Table.Discount__,ROW()),100)))

 

But, the above gives me the following result: 

 

Example of how I can get it at 50% at the moment:

Now, I have tried changing the calculation to use "1" or "10" instead of "100" in the DIV area and this still does not provide me with the correct calculation I am after. 

 

I would like the calculation to be completed once a % is entered as this can be changed based on requirements. 

 

Any assistance or feedback would be appreciated,

 

Thank you

Ziad

0 0

Answer

SELECTED ANSWER
replied on June 6, 2018 Show version history

Hi Ziad,

 

Try this. Just make sure you update your table variables accordingly.

 

=INDEX(Table.qty,ROW())*INDEX(Table.price,ROW())*(1-DIV(INDEX(Table.discount,ROW()),100))

 

you may also want to add an IF condition or two in there to prevent the calculation error such as:

=IF(INDEX(Table.discount,ROW())>=0,INDEX(Table.qty,ROW())*INDEX(Table.price,ROW())*(1-DIV(INDEX(Table.discount,ROW()),100)),0)

 

Kind Regards,

 

Aaron

2 0
replied on June 6, 2018 Show version history

Hi Aaron, 

 

I made the adjustment to my calculation based on your recommendation, and it calculates it as it should! 

 

=SUM(PRODUCT(INDEX(TableQuantity,ROW())*INDEX(Table.Price,ROW()))*(1-DIV(INDEX(Table.Discount__,ROW()),100)))

 

 

Thanks again,

Ziad

 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.