Calculate an average of two separate numbers and show the result at the same time

Hello! I am trying to calculate the average of input fields for blood pressure readings. Viewers need to input top and bottom numbers, and the system should calculate the average. I found a similar solution online but need to figure out how to handle two separate elements for the numbers. I am unsure if I can implement this due to the complexity of the actions involved.

here is a Loom I made!: Calculating Average Blood Pressure Input Fields | Loom

There are many ways to do this, but to clarify, are you trying to calculate the average between just two numbers (top and bottom numbers) or between a list of top numbers and bottom numbers?

What you plan to do with this calculated number? Do you need to store it or just display it on the fly? Are the numbers free-typed all the time or it will be get from some source in specific cases?

Thank you for replying!
Calculating the average between a list of top numbers and a list of bottom numbers.
I am not planning on storing this data, at this stage a user can just calculate the average and I will add in a screenshot plugin that will save the screenshot if they want to keep it to show their doctor

Will this list have a specific amount of items, lets say 10 top numbers and 10 bottom numbers, or this will be dynamic, sometimes more, other times less?

How you are going to generate this list? Using a Repeating Group (RG) or just some static elements like inputs in these case)?

I am asking this because if it are just some static pairs of numbers you can make a direct expression to calculate this. Otherwise, using a RG you can use states and a little bit of logic based on input changes or some plugin like Orchestra to manipulate the data inside each RG cell.

it will be a specific amount of numbers: 6 top numbers and 6 bottom numbers.
I had just used inputs so that I would have more flexibility for design, a table wouldn’t really work in this instance

I hope this can give you some ideas and help in some way.

Link to Editor
Link to Preview

This is AMAZING! The first approach is exactly what I’m after; however, when I try to create the average input box, I don’t seem to be able to break up the formulas with the brackets…this is probably very silly of me but there isn’t a ( option in the initial content box. I understand that to calculate the average we need to add all the values together

Go to settings tab > versions > enable parenthesis

1 Like

Oh my goodness, you’re the best!! You’ve been so incredibly helpful; I can’t offer any good code advice, but if you ever need anything designed, I’d be happy to help!! https://www.linkedin.com/in/anniegatenby/

2 Likes