View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Converting 123 CR & 4567 DB to 123 & -4567

Select the cells you want to convert and run:

Sub FixThem()
For Each r In Selection
v = r.Value
vn = Left(v, Len(v) - 3)
If Right(v, 2) = "DB" Then
r.Value = -vn
Else
r.Value = vn
End If
Next
End Sub
--
Gary''s Student - gsnu200909


"bud i" wrote:

My financial report with several columns and all the rows displays numeric
values as text with DB and CR that I need to convert to positive and negative
numerics. The following function does the job, but is there a macro
available that would do it?

=IF(RIGHT(E12,3)=" cr",1*LEFT(E12,LEN(E12)-3),-1*LEFT(E12,LEN(E12)-3))