lou
lou

Reputation: 21

Only roundup if ends with .4 or above

Can anyone help me with a formula that roundups up a number only if it ends with .4 or more, otherwise it should stay as it is.

Eg. 1.4 rounds to 2 ; 2.5 rounds to 3 ; 2.3 stays at 2.3

Perhaps i should also mention that the number that needs rounding may sometimes have more than 1 decimal place

Hopefully this is clear enough

Upvotes: 0

Views: 3376

Answers (3)

jsheeran
jsheeran

Reputation: 3037

=FLOOR(num+0.6,1) will do the trick.

Upvotes: 4

G42
G42

Reputation: 10019

I believe this is what you're after.

Formula

=IF(LEN(A1)>2,IF(NUMBERVALUE(MID(A1,FIND(".",A1)+1,1))>3,ROUNDUP(A1,0),A1),A1)

Explanation

  • LEN(A1)>2 Check if cell is 3 characters or more. Whole numbers are 1, so ignore them
  • MID(A1,FIND(".",A1)+1,1) - Find the character to the right of the decimal point. Returns text..
  • NUMBERVALUE(...)>3 - Convert that text, and check it is greater than 3.
  • ROUNDUP(A1,0) - Only if that is true, round up the number. Otherwise return it as it is.

Example

Rounded Data

Upvotes: 0

to StackOverflow
to StackOverflow

Reputation: 124706

How about:

=IF(ROUND(A1+0.1,0)>A1,ROUND(A1+0.1,0),A1)

Upvotes: 2

Related Questions