# ROUND function

**URL:** https://community.glideapps.com/t/round-function/49856
**Category:** Ask for Help
**Created:** [September 22, 2022, 12:43am UTC](https://community.glideapps.com/t/round-function/49856 "2022-09-22T00:43:47Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![drascon](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drascon/32/20070_2.png) [@drascon](https://community.glideapps.com/u/drascon)
#### Post date: [September 22, 2022, 12:43am UTC](https://community.glideapps.com/t/round-function/49856/1 "2022-09-22T00:43:47Z")

</div>

Hello all!

I’m having a very difficult time figuring out the ROUND function syntax.

USE CASE: I have a static spreadsheet in Excel where I use the MROUND function to make medication volumes end in either a zero (X.0), 5/10ths (X.5) or 5/100ths (X.X5) for easy administration. That formula is “=MROUND(“cell #”), 0.X” with the X having as many or as few zeroes as needed to round where I need it to. I’ve tried multiple ways to get this to work in the Editor but I can’t quite get it right. I’m attempting to emulate the spreadsheet with a live calculator in my app but I’m losing this battle.

Can someone please please help??? 🙏

Thank you!

Dustin

---

<div class="post-metadata">

### Author: ![Devesh\_Khandelwal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/devesh_khandelwal/32/43432_2.png) [@Devesh\_Khandelwal](https://community.glideapps.com/u/Devesh_Khandelwal)
#### Post date: [September 22, 2022, 1:59am UTC](https://community.glideapps.com/t/round-function/49856/2 "2022-09-22T01:59:55Z")

</div>

can you share your sheet data

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [September 22, 2022, 2:11am UTC](https://community.glideapps.com/t/round-function/49856/3 "2022-09-22T02:11:51Z")

</div>

Haven’t encountered MROUND before, so I had to look it up.  
According to the [doc](https://support.microsoft.com/en-us/office/mround-function-c299c3b0-15a5-426d-aa4b-d2d5b3baf427), its function is slightly different from how you describe it.

That is, the 0.X in your example has nothing to do with the number of zeros, but is rather the _multiple_ that the number should be rounded to. So for example, if you specify 0.07 then the number should be rounded to the nearest multiple of 0.07.

The ROUND function in Glide just allows you to specify the number of decimal places to round the result to, so it’s not quite the same.

To get the same as you would with MROUND will probably require a slightly more complex formula combining both MOD and ROUND.

I’ll have a fiddle with it…

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [September 22, 2022, 4:28am UTC](https://community.glideapps.com/t/round-function/49856/4 "2022-09-22T04:28:54Z")

</div>

I think I actually have this same problem to solve by the end of the month for my app. It might ultimately be best done with a javascript column, but I’m going to see if I can figure it out with a math column.

> <https://stackoverflow.com/questions/28003077/like-excel-mround-function-in-javascript>

**EDIT**  
So this might not be too bad, at least in my case. I’m basically doing the same thing as the javascript function in the link above, but in a math column.

A standard round should work for your X.0 case  
`round(value)`

This should round to the nearest quarter  
`25*round(value/25,2)`

This should round to the nearest half and would work for your X.5 case.  
`5*round(value/5,1)`

This should work for your X.X5 case.  
`5*round(value/5,2)`

Still wrapping my head around it, but looks promising.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [September 22, 2022, 4:57am UTC](https://community.glideapps.com/t/round-function/49856/5 "2022-09-22T04:57:47Z")

</div>

I tried just converting that JavaScript example to a math formula, and this is what I got:

`Factor * Round(Number/Factor)`

![Screen Shot 2022-09-22 at 12.55.15 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/7/074fc84c7569285f9b660f2309e68633b4d8de59.png)

 ![Screen Shot 2022-09-22 at 12.57.05 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/c/8cde6f71a7f5754e816b63a205e776959561e64d.png)

Looks correct, I think? 🤔

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [September 22, 2022, 5:05am UTC](https://community.glideapps.com/t/round-function/49856/6 "2022-09-22T05:05:33Z")

</div>

Yeah, I think I like @Darren_Murphy’s method better. Seems to make more sense than the way I did it.

---

<div class="post-metadata">

### Author: ![drascon](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drascon/32/20070_2.png) [@drascon](https://community.glideapps.com/u/drascon)
#### Post date: [September 22, 2022, 7:59pm UTC](https://community.glideapps.com/t/round-function/49856/7 "2022-09-22T19:59:35Z")

</div>

@Jeff_Hager and @Darren_Murphy - you dudes are the best!! Thank you for always coming up with the right answers, quickly!! 🙏

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [September 23, 2022, 8:00pm UTC](https://community.glideapps.com/t/round-function/49856/8 "2022-09-23T20:00:08Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
