Skip to main content
Participant
July 27, 2016
Question

Figure the percentage range of a single number

  • July 27, 2016
  • 3 replies
  • 310 views

For example is there anyway to have java calculate 60%-80% of 300 and display the answer in format similar to 180-240?  The number I need to get the ranges on are in one cell and I'd like the result displayed in a second.

This topic has been closed for replies.

3 replies

Participant
July 28, 2016

What I am trying to do is an auto calculating form fillable sheet for a friends pen and paper rpg.  They would enter their hit points the 300 in the above example.  The character is stunned if they take damage that puts them between 60%-80% of their max hit points.  Figuring out and displaying what the 60%-80% of that 300 is where I am running into problems.

Inspiring
July 27, 2016

So you have one field that has the value of "60%-80%" and the other a user entered value and you want a script to calculate the numeric range of the entered number base on the percentage range of the first field. Since the first field is a character string you need to parse that string into the number and symbols , you can then convert the whole numbers that are the percentages into two variables, the first being the lower percentage, in your example 0.60, and the upper percentage, 0.80 in your example.

Is the first field user entered?

If not you should be able to use the hard coded values from that field.

try67
Community Expert
Community Expert
July 27, 2016

Just multiply the values of the two fields and it should work.