Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,045
Default Multiplying a Number Found in an Alphanumeric String

On Fri, 7 Dec 2012 16:28:59 +0000, Randomerz wrote:

The one constant throughout is that the "$" sign precedes every price.


Perhaps the following will do what you require. It multiplies every value that both looks like a number and is also preceded by a "$", by mult, and replaces it in the original string.

=====================================
Option Explicit
Function MultDollars(s As String, mult As Double) As String
Dim re As Object, mc As Object
Dim i As Long
Set re = CreateObject("vbscript.regexp")
With re
.Global = True
.Pattern = "\$(\d+(?:\.\d+)?)"
End With

If re.test(s) = True Then
Set mc = re.Execute(s)
For i = mc.Count - 1 To 0 Step -1
s = Left(s, mc(i).firstindex + 1) & _
Format(mc(i) * mult, "#0.00") & _
Mid(s, mc(i).firstindex + 1 + mc(i).Length)
Next i
MultDollars = s
End If
End Function
=============================
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Multiplying a Number Found in an Alphanumeric String

This is not working.
for eg: Cell A1: 67x89x6inch

I want each and every number must be multiplied by 2.54 (to convert in cm)
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Multiplying a Number Found in an Alphanumeric String

This is not working.
for eg: Cell A1: 67x89x6inch

I want each and every number must be multiplied by 2.54 (to convert in cm)
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Multiplying a Number Found in an Alphanumeric String

This is not working.
for eg: Cell A1: 67x89x6inch

I want each and every number must be multiplied by 2.54 (to convert in cm)
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Multiplying a Number Found in an Alphanumeric String

Hi,

Am Sun, 15 Nov 2015 07:53:36 -0800 (PST) schrieb :

for eg: Cell A1: 67x89x6inch

I want each and every number must be multiplied by 2.54 (to convert in cm)


please look he
https://onedrive.live.com/redir?resi...=folder%2cxlsm
for "InchToCm"
There is an UDF to convert inches to cm.


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


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
random alphanumeric string [email protected] Excel Worksheet Functions 4 April 21st 23 09:04 AM
Extracting 7 digit number from alphanumeric string snowball Excel Discussion (Misc queries) 5 August 31st 09 11:51 AM
Comparison of alphanumeric string ErExcel Excel Discussion (Misc queries) 4 May 7th 07 02:14 PM
Multiplying to string arrays smaruzzi Excel Discussion (Misc queries) 2 October 14th 06 07:25 PM
How do I replace last numeric string from a alphanumeric string? Christy Excel Discussion (Misc queries) 3 August 11th 06 12:17 AM


All times are GMT +1. The time now is 12:54 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"