×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here

Jobs

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

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,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close