Round to nearest number - Divisible by 4,000

I am using the following formula to round the resulting number to the nearest 1,000:


Open in new window

I need to modify this formula so it rounds to the nearest number divisible by 4,000.

Thanks for your help.
Who is Participating?
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Just replace your 1000's with 4000's to get the expected result:
            Int( (999000*1.2) / 4000 + 0.5 ) * 4000
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:

Give this a whirl...

Declare @num numeric = 5538354.25

SELECT CAST(ROUND(@num / 4000,0) as int) * 4000

Let us know if you're asking for this as an Access query expression, SQL Server T-SQL, or Excel expression.
Gustav BrockCIOCommented:
You can simply use:

RoundedUp: -Int(-999000*1.2/1000)*1000


RoundedUp4000: -Int(-999000*1.2/4000)*4000

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.