I have a column full of numbers. Some of the numbers have periods at the end, and are followed by more numbers or letters. Is there a macro to delete that period and everything to the right of it?
I have a column full of numbers. Some of the numbers have periods at the end, and are followed by more numbers or letters. Is there a macro to delete that period and everything to the right of it?
If your column full of numbers is in A1:Axxx, put this in B1 and fill down:
=LEFT(A1,FIND(".",A1)-1)+0
That will return the text left of the decimal and convert it to a number. if you want to leave it as a text string, then remove the +0 at the end of the formula.
- Moo
Last edited by Moo the Dog; 12-21-2012 at 02:06 PM.
Probably should add an error wrapper around that function just in case a cell in column A doesn't have a decimal. Change the formula to:
=IFERROR(LEFT(A1,FIND(".",A1)-1),A1)+0
- Moo
Note: The only reason I am using the LEFT function is because you said there may be letters to the right of the decimal. If your data only contained numbers (only numbers on both sides of the decimal) then you could just use =INT(A1).
Life is much easier when letters and numbers don't mix.
Last edited by Moo the Dog; 12-21-2012 at 02:16 PM. Reason: Added note.
Thanks MOO. This formula works well.
Glad to help.
- Moo
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks