Sheets formula using GCD convert to appsheet VC


I used to have formulas execute on the spreadsheet but I need the data to be within the app so I can manipulate it further.

The function in the sheet is:

=IFS(H2 = “”, “”, GCD(H2,2000)=2000,2000,GCD(H2,1000)=1000,1000,GCD(H2,500)=500,500,GCD(H2,250)=250,250)

Which basically says if h2 is empty this is empty (just so the sheet doesnt return REF),
then find the greatest common divisor of h2 and 2000, if it equals 2000 then use 2000. this continues down to 250.

I would like to convert this into my app but appsheet doesnt have a GCD expression, I am not very good at maths and the videos ive seen online about GCD calculate it by hand.
Does anyone know what the GCD formula in google sheets looks like using expression that appsheet has?

What are you trying to accomplish by comparing the greatest common divisors?

Our machinery is serviced every 250 operating hours.
These are the different size services we do:

If a machine has 1500 hours it will get a 500 hr service
If a machine has 1000 hours it will get a 1000 hr service
If a machine has 13250 hours it will get a 250 hr service
If a machine has 8750 hours it will get a 250 hr service
If a machine has 22000 hours it will get a 2000 hr service

This formula is used to work that out so the user doesnt make a mistake in prepping the wrong service kit. Which has happened before and the intent of this VC is to stop that from happening again.

1 Like