Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
edwardpestian
 
Posts: n/a
Default Ending Negative Sign


I have figures that I copy and paste from AS400 into an Excel worksheet.
The figures get pasted as text with a minus sign after the number for
negative values: 2340-. I need to convert these numbers to <2340
format.

I simply need a formula that says if this range has values with "-" at
the end of the number, then format <xxxx, otherwise format as +xxxx.

Thanks.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=556349

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
arno
 
Posts: n/a
Default Ending Negative Sign

hi,

try to convince sbd. to bring the - sign on the other side.

otherwise, that'll do:

=if(right(a1,1)="-", -value(left(a1, len(a1)-1)), value(a1))

arno
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
edwardpestian
 
Posts: n/a
Default Ending Negative Sign


It works, but not quite as I need it to. I would like the formula to
refer to a range of cells - for example A1:A10. When data is entered
into these cells, it automatically converts the data to the correct
format (In the same cell that the data was entered).

Thanks again.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=556349

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Ending Negative Sign

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10"
Dim cell As Range

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each cell In Target
If Right(cell.Value, 1) = "-" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 1) * -1
cell.NumberFormat = "0;<0"
End If
Next cell
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"edwardpestian"
wrote in message
news:edwardpestian.2a3rqp_1151482204.4269@excelfor um-nospam.com...

It works, but not quite as I need it to. I would like the formula to
refer to a range of cells - for example A1:A10. When data is entered
into these cells, it automatically converts the data to the correct
format (In the same cell that the data was entered).

Thanks again.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile:

http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=556349



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
edwardpestian
 
Posts: n/a
Default Ending Negative Sign


Thanks Bob.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=556349



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
change the negative sign to brackets but no choice is available the old guy Excel Worksheet Functions 1 March 16th 06 11:17 PM
flip negative sign wilson@irco Excel Discussion (Misc queries) 6 March 13th 06 12:30 PM
How can i put a negative sign on a range of selected cells? chermaine Excel Discussion (Misc queries) 3 August 8th 05 02:49 AM
FORMULA TO ADD POSITIVE AND NEGATIVE NUMBERS, REGARDLESS OF SIGN JON Excel Discussion (Misc queries) 3 July 18th 05 06:35 PM
Automatically put negative sign in cells with positive numeric dat ctdak Excel Discussion (Misc queries) 4 June 24th 05 09:41 PM


All times are GMT +1. The time now is 07:05 AM.

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

About Us

"It's about Microsoft Excel"