How to Round Up in Cell in Google Sheets

Learn how to round up numbers directly in a Google Sheets cell using Apps Script, without needing to create additional columns. This tutorial demonstrates a simple onEdit function to achieve this functionality.

you wanna round up a number in a cell and we don't wanna do something like equals round up, equals this cell and then have it in another column? We don't wanna do that. We want it in the same column, in the B column. Let's do this. Go to Extensions, Apps Script Let's rename this to Round Up. We're gonna create a function on edit we're gonna put a little event here inside of the parentheses. Do those curly brackets And then we need a variable range to know where we are on the sheet, e. range or event. range Then if range.getColumn is equal to two, because we're in the second column, if you change the column you want to be in, change this two to something else, and range.get row is greater than one because we want to make sure we're not editing the header row. If those are true, then we want to edit our range that we're in. So setValue , we use capital M-A-T-H, Math.C-E-I-L, that's ceiling We're gonna put our value in there. That value is gonna be variable value equals event.value. That is the value of the cell. If we're deleting that cell's value, then we wanna go here, uh, event.value. Make sure that there's something there, because we don't wanna round up if there's no actual value. So let's go see. Let's go do four, one, two. It rounds up to five.

not editing the header row . If those are true, then we want to edit our range that we're in. So setValue , we use capital M-A-T-H, Math.C-E-I-L, that's ceiling We're gonna put our value in there. That value is gonna be variable value equals event.value. That is the value of the cell. If we're deleting that cell's value, then we wanna go here, uh, event.value. Make sure that there's something there, because we don't wanna round up if there's no actual value. So let's go see. Let's go do four, one, two. It rounds up to five. Spreadsheet Automation 101 Lesson 2: onEdit() Trigger Delete A Row When Writing a Certain Word

3.1415926. There you go, four. So it's rounding up no matter what we do. 7.11111. Got 9.01. Pretty cool, right? It's rounding all the way up to a round number You're watching Better Sheets here on YouTube. You have two options here for your next video. Before you go, comment down below if you have any question whatsoever, and I'll make future videos from those questions. But for right here, right now, one of these videos could be your next Google Sheet How to Iterate Counting Blank Cells in Google Sheets Figure Out Frequency of Numbers WRONG ROUNDDOWN