×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Excel: Keep trailing zero for integers, drop for all other numbers

## Excel: Keep trailing zero for integers, drop for all other numbers

(OP)
So, I am trying to write a quick way to format metric fastener pitches in a table. The values are converted to a string, as I'm outputting a completely descriptive size, based on the input parameters. The problem I'm encountering is that I can't find a way to force Excel to drop all trailing zeroes EXCEPT in the case of integers, where I want them to display to one place.

So, IF a value is an integer, THEN, display X.0

ELSE, normal behavior for general numbers. (1.2, 1.37, etc)

How might I accomplish this?

Thank you.

### RE: Excel: Keep trailing zero for integers, drop for all other numbers

Hi,

Assuming that the value is in A1...

=IF(INT(A1)=A1,TEXT(A1,"#.0"),TEXT(A1,"@"))

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: Excel: Keep trailing zero for integers, drop for all other numbers

Alternative formula (hope that thereis sufficient number of #s):
=TEXT(VALUE(A1),"0.0#################")
If in A1 you have value, replace VALUE(A1) by A1.

combo

### RE: Excel: Keep trailing zero for integers, drop for all other numbers

(OP)
Thanks, SkipVought. Worked perfectly.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!