Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Problem with a a number ending in -

Ok a system that i work with outputs a neg number like this 100-. So the
problem is this, since the system does this it make that number text. What i
need is if - show up i need to some how move it to the first spot so that it
can be viewed as a number and not text.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Problem with a a number ending in -

=IF(RIGHT(A1,1)="-",-1 * VALUE(LEFT(A1,LEN(A1)-1)),A1)

"jln via OfficeKB.com" wrote:

Ok a system that i work with outputs a neg number like this 100-. So the
problem is this, since the system does this it make that number text. What i
need is if - show up i need to some how move it to the first spot so that it
can be viewed as a number and not text.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Problem with a a number ending in -

Select your range and run this macro:

Sub changeCells()
Dim r As Range, cell As Range
On Error Resume Next
Set r = Intersect(Selection.SpecialCells(xlConstants, xlTextValues),
Selection)
On Error GoTo 0
If Not r Is Nothing Then
For Each cell In r
If Right(cell, 1) = "-" Then
cell.Value = CDbl(cell.Value)
End If
Next
End If
End Sub

--
Regards,
Tom Ogilvy


"jln via OfficeKB.com" wrote:

Ok a system that i work with outputs a neg number like this 100-. So the
problem is this, since the system does this it make that number text. What i
need is if - show up i need to some how move it to the first spot so that it
can be viewed as a number and not text.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in round up or down price to specific ending number Ms. Latte[_2_] Excel Discussion (Misc queries) 1 August 8th 08 12:29 PM
How do I keep a 17 digit number from ending in "0" in excel? creel28270 Excel Discussion (Misc queries) 6 June 18th 08 04:12 PM
ending vba Arnold Klapheck Excel Programming 4 August 29th 06 08:15 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM
Ending Sub Paul Excel Programming 3 October 1st 04 07:48 PM


All times are GMT +1. The time now is 09:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"