Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Parse formula

Also posted on L list

How can I turn this

=SUM(IU6+IU16+IU28+IU57*2+IU99*2)

into
=iu6 better yet = a6 which is text
=iu16
=iu28
=iu57*2
=iu99*2

preferable turn the last two into
=a57 (which is TEXT) and *2 in text
like where a57 is item4 in text
=item4 *2


--
Don Guillett
SalesAid Software





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Parse formula

Don,

I wrote a function to extract arguments from a formula
(http://www.vangelder.co.nz/excel/index.html)
You might be able to change the line which reads:
Application.International(xlListSeparator) to use a "+" instead.

Rob


"Don Guillett" wrote in message
...
Also posted on L list

How can I turn this

=SUM(IU6+IU16+IU28+IU57*2+IU99*2)

into
=iu6 better yet = a6 which is text
=iu16
=iu28
=iu57*2
=iu99*2

preferable turn the last two into
=a57 (which is TEXT) and *2 in text
like where a57 is item4 in text
=item4 *2


--
Don Guillett
SalesAid Software






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Parse formula

Rob, Thanks for your reply. I have not had a chance yet to try your code.
Here is one I developed with help on the 1st part by Damon Longworth on the
L list. From this
=SUM(IU9+IU23*2+IU30*4+IU40*2+IU55*2+IU100*8)
to this where this text was in the A column for each formula, depending on
row.
277-4L BALLAST
KLFIT/SA/4*2
4FT F32/841LAMP30*4
2x4-LENS/KSH-23*2
# 131'2X4-TROFFER FIX CAN*2
120 76 W BALLASTIU100*8


using
Sub ParseFormula()
For Each mformula In Range("d138:bc138")
MYformula = mformula.Formula
MYformula = Mid(MYformula, WorksheetFunction.Find("(", MYformula) + 1)
iLength = WorksheetFunction.Find("+", MYformula)
mformula.Offset(3, 0) = Mid(MYformula, 1, iLength - 1)
MYformula = Mid(MYformula, iLength + 1)
For i = 1 To Len(MYformula) - _
Len(WorksheetFunction.Substitute(MYformula, "+", ""))
iLength = WorksheetFunction.Find("+", MYformula)
mformula.Offset(i + 3, 0) = Mid(MYformula, 1, iLength - 1)
MYformula = Mid(MYformula, iLength + 1)
Next
mformula.Offset(i + 3, 0) = Left(MYformula, Len(MYformula) - 1)

'me below
mr = mformula.Row
mc = mformula.Column
On Error Resume Next
For Each c In Range(Cells(mr + 3, mc), Cells(mr + 10, mc))
If InStr(c, "*") Then
x = InStr(c, "*")
storit = Right(c, Right(c, Len(c) - x))
c.Value = "=A" & Mid(c, 3, Len(c) - x + 1)
c.Value = c & storit
Else
c.Value = "=a" & Mid(c, 3, Len(c) - 2)
End If
Next c
Next mformula
End Sub



--
Don Guillett
SalesAid Software

"Rob van Gelder" wrote in message
...
Don,

I wrote a function to extract arguments from a formula
(
http://www.vangelder.co.nz/excel/index.html)
You might be able to change the line which reads:
Application.International(xlListSeparator) to use a "+" instead.

Rob


"Don Guillett" wrote in message
...
Also posted on L list

How can I turn this

=SUM(IU6+IU16+IU28+IU57*2+IU99*2)

into
=iu6 better yet = a6 which is text
=iu16
=iu28
=iu57*2
=iu99*2

preferable turn the last two into
=a57 (which is TEXT) and *2 in text
like where a57 is item4 in text
=item4 *2


--
Don Guillett
SalesAid Software








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
Parse Text Erin Excel Discussion (Misc queries) 1 June 18th 09 10:17 PM
How to parse data Dave F Excel Discussion (Misc queries) 0 August 17th 06 07:32 PM
Parse from the Right PA Excel Worksheet Functions 6 June 11th 06 06:05 PM
How do I capitalize and parse in the same formula? blondegreenjeans Excel Worksheet Functions 2 December 8th 05 01:57 AM
Parse Sarah[_4_] Excel Programming 2 December 30th 03 11:16 PM


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