r/excel • • 5d ago

solved Different rounding parameters in the same cell

Firstly, thank you all for all the help you’ve been the last day or two. It makes everything so much easier when I can ask a person instead of googling everything.

Cell G7 has a formula based on the values in cells G4,5,6. Cell G8 needs to round the number in G7. The specific formula I need is: if G4 is 0-1999 then I need the value in G7 to be rounded up to the nearest 100 in G8, if the value in G4 is >=2000 then I need the value in G7 to round up to the nearest 1000 in G8.

6 Upvotes

17 comments sorted by

•

u/AutoModerator 5d ago

/u/TheAKofClubs86 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/NomNomBelt 1 5d ago

=IF(G4<2000,ROUNDUP(G7,-2),ROUNDUP(G7,-3))

Enter this in cell G8

1

u/TheAKofClubs86 5d ago

Perfect, thank you.

1

u/NomNomBelt 1 5d ago

Glad it worked! Could you reply to my top-level comment with “Solution Verified” to mark this as solved?

1

u/TheAKofClubs86 5d ago

Solution verified

1

u/reputatorbot 5d ago

You have awarded 1 point to NomNomBelt.


I am a bot - please contact the mods with any questions

1

u/PepperIcy4822 5d ago

Is G4 exactly 2000 rounding up or down?

1

u/TheAKofClubs86 5d ago

Up

2

u/GTS_84 6 5d ago

If g4 is always going to be positive and you aren't worried about a negative number or empty cells, then I think you would want something like =IF(G4>=2000,ROUNDUP(G7,-3),ROUNDUP(G7,-2)) should do the trick.

1

u/TheAKofClubs86 5d ago

Someone beat you to it by a minute, but thank you.

1

u/TheAKofClubs86 5d ago

Edited the OP to reflect it

1

u/PepperIcy4822 4d ago

been there, half my "quick formula" threads turn into an edit war once someone points out the edge case. At least now the IF is actually testable against the spec instead of guessing at it.

1

u/PaulieThePolarBear 1927 5d ago

Can G4 ever be negative? If so, clearly state your rounding requirements

1

u/TheAKofClubs86 5d ago

No, it cannot be negative and will only be a whole number.

1

u/PaulieThePolarBear 1927 5d ago

Then, based upon my understanding of your post

=ROUNDUP(G7, -2 - (G4>=2000))

2

u/bradland 279 5d ago

You can do this with a straight forward conditional:

=IF(G4>=2000, ROUNDUP(G7, -3), ROUNDUP(G7, -2))