Solved

excel format number

Posted on 2008-10-04
1
215 Views
Last Modified: 2012-05-05
For some reason I have a column and the positive/negative sign follows the number like 10.22+ or 45.55-.

Excel does not recognize this as a number.  How can I get the + or - before the number instead of after it?

I tried selecting everything, and formatting, but that did not work.
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 22641669
You're going to need a little macro help. The routines below convert negative numeric values with trailing negative signs (e.g., "123-") into numeric values. When entering or importing such values Excel interprets them as text instead of numeric values.

Select the cells to convert and run the macro ConvertTrailingNegativeValuesDefault.

[Begin Code Segment]

Public Sub ConvertTrailingNegativeValuesDefault()

' Call the routine ConvertTrailingNegativeValues using the current selection.

   ConvertTrailingNegativeValues Selection
   
End Sub


Public Sub ConvertTrailingNegativeValues( _
      ByVal Target As Range _
   )

' Convert any numeric values with trailing negative signs to numeric values.
'
' Syntax
'
' ConvertTrailingNegativeValues(Target)
'
' Target - The range containing the values to convert.

   Dim Cell As Range

   For Each Cell In Target
      If Len(Cell) > 1 Then
         If VarType(Cell) = vbString Then
            If Right(Cell, 1) = "-" And IsNumeric(Left(Cell, Len(Cell) - 1)) Then
               Cell = CDbl(Cell)
            End If
         End If
      End If
   Next Cell

End Sub

[End Code Segment]

Kevin
0

Featured Post

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My experience with Windows 10 over a one year period and suggestions for smooth operation
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question