# Thread: nearest 5 Thanks: 0 Likes: 0

1. ## nearest 5

Hello,
I am trying to define some range of numbers by the nearest down 5 (i.e. 7 to 5 and 43 to 40) is there any easy way to do it by PQ or
PP ?
Thanks.

2. ## Re: nearest 5

The standard approach I use is round(number/target,0)*target. So, in Excel use ROUND(x/5,0)*5. In PowerQuery, use Number.Round(x/5,0,roundingmode.awayfromzero) -- with the appropriate capitalization.
Originally Posted by ahmedismailfourtex
Hello,
I am trying to define some range of numbers by the nearest down 5 (i.e. 7 to 5 and 43 to 40) is there any easy way to do it by PQ or
PP ?
Thanks.

3. ## Re: nearest 5

The question is a bit confusing as you don't want to round to the nearest, but you want to round down to a multiple of 5.
That would be: 5*Number.RoundDown(x/5,0)

4. ## Re: nearest 5

Originally Posted by MarcelBeug
The question is a bit confusing as you don't want to round to the nearest, but you want to round down to a multiple of 5.
That would be: 5*Number.RoundDown(x/5,0)
that's absolutely right

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•