Hi
I have written a macro to parse a trendline equation (peak area vs concentration) so I can use it to calculate chemical concentrations from area data. What I have written does the job for a single trendline equation on a spreadsheet. However, when I run the macro on a second trendline equation on the same sheet, the first set of extracted coefficients becomes the same as the second set of coefficients. This is because my macro places a formula in the cell I want the coefficient to be in, not a value (see attached JPG). Is there some way that I can convert the extracted coefficient from a formula to a value?
Thanks
Arjay
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Parsing trendline equation
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Parsing trendline equation
- This topic has 8 replies, 4 voices, and was last updated 12 years, 5 months ago.
AuthorTopicWSarjay13
AskWoody LoungerDecember 10, 2012 at 9:35 am #486759Viewing 4 reply threadsAuthorReplies-
WSsdckapr
AskWoody LoungerDecember 10, 2012 at 11:01 am #1362039To use values instead of formulas, your code could be written like:
Code:Sub Parse_Coeffs() Dim str As String With ActiveCell str = .Value If Left(str, 1) = "-" Then .Offset(1, 0) = Left(str, 10) .Offset(2, 0) = Mid(str, 13, 12) .Offset(3, 0) = Mid(str, 27, 12) Else .Offset(1, 0) = Left(str, 9) .Offset(2, 0) = Mid(str, 12, 12) .Offset(3, 0) = Mid(str, 26, 12) End If End With End Sub
This puts the calc in VBA and just adds the values into the cells, instead of putting the formulas into the cells.
Steve
-
WSarjay13
AskWoody LoungerDecember 10, 2012 at 2:13 pm #1362059Sdckapr
Many thanks for the prompt reply as well as the tidy code. It works better and cleaner than what I had ginned up. I discovered that if I copy the entire trendline equation including the “=” (accounting for the added characters in the “left” and “mid” commands), the macro doesn’t get the exponents and leading signs correct with a leading minus sign after the “=”. If I leave out the “=” sign and carefully cut the equation, it works perfectly!
Thanks
Arjay -
WSarjay13
AskWoody Lounger
-
-
RetiredGeek
AskWoody_MVPDecember 10, 2012 at 2:05 pm #1362058Now that Steve did the heavy lifting…
How about:Code:Sub Parse_Coeffs() Dim str As String Dim iAdj As Integer iAdj = 0 With ActiveCell str = .Value If Left(str, 1) = "-" Then iAdj = 1 .Offset(1, 0) = Left(str, 9 + iAdj) .Offset(2, 0) = Mid(str, 12 + iAdj, 12) .Offset(3, 0) = Mid(str, 26 + iAdj, 12) End With End Sub
:cheers:
-
WSsdckapr
AskWoody Lounger -
WSarjay13
AskWoody Lounger
-
-
WSsdckapr
AskWoody Lounger -
WSbliengme
AskWoody LoungerDecember 13, 2012 at 7:43 am #1362498The LINEST route is the only reliable one. See http://people.stfx.ca/bliengme/ExcelTips/Polynomial.htm
Viewing 4 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Who knows what?
by
Will Fastie
32 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
29 minutes ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
14 minutes ago -
Misbehaving devices
by
Susan Bradley
17 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
17 hours, 53 minutes ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
13 hours, 37 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
16 hours, 27 minutes ago -
Discover the Best AI Tools for Everything
by
Alex5723
16 hours, 36 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
6 hours, 45 minutes ago -
Rufus is available from the MSFT Store
by
PL1
14 hours, 47 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
1 day, 17 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
20 hours, 14 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
1 day, 13 hours ago -
Office gets current release
by
Susan Bradley
1 day, 16 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
3 days, 6 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
2 days, 14 hours ago -
Stop the OneDrive defaults
by
CWBillow
3 days, 6 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
3 days, 16 hours ago -
X Suspends Encrypted DMs
by
Alex5723
3 days, 19 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 days, 19 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
3 days, 19 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
3 days, 20 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
3 days, 8 hours ago -
Enabling Secureboot
by
ITguy
3 days, 15 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
4 days, 4 hours ago -
No more rounded corners??
by
CWBillow
4 days ago -
Android 15 and IPV6
by
Win7and10
3 days, 14 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
4 days, 16 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
4 days, 19 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.