Bắt đầu ngayBắt đầu miễn phí

Rounding negative numbers

FLOOR() and CEILING() will round negative numbers towards or away from negative infinity. That is, FLOOR(-1.5) is -2 and CEILING(-1.5) is -1.

Sometimes you may wish to round them towards or away from zero.

Google Sheets has two related functions called FLOOR.MATH() and CEILING.MATH(). When given one or two arguments, they behave in the same way as FLOOR() and CEILING() respectively. However, you can pass a third argument that determined the direction of the rounding: passing a positive number (for example, 1) to a third argument to make them round in the positive direction - towards zero.

That is, FLOOR.MATH(-1.57, 0.1, 1) is -1.5 and CEILING.MATH(-1.57, 0.1, 1) is -1.6.

Bài tập này là một phần của khóa học

Google Sheets nâng cao

Xem khóa học

Hướng dẫn bài tập

  • In column H, take the perihelion and subtract the aphelion (column G minus column F) to create some negative numbers.
  • In column I, use FLOOR.MATH() to round those differences to the next hundredth (0.01) towards zero.
  • In column J, use CEILING.MATH() to round those differences to the next tenth (0.1) away from zero.

Bài tập tương tác thực hành

Biến lý thuyết thành hành động với một trong các bài tập tương tác của chúng tôi

Bắt đầu bài tập