Pulling out certain characters from a cell

andreascostas

Board Regular
Joined
Jan 11, 2011
Messages
150
I have this equation in cell a1: 15x2 + 13x – 20
I want to pull out the coefficients and the constant in three separate cells.
I use =LEFT(a1,FIND("x",a1)-1) to pull out the 15…..I am having trouble pulling
Out the 13 and the 20
Help please
The function should work with other similar equations such as: 9x2 - 27x + 20
 
I disagree that this produces the form indicated by the OP. You pointed out that the OP wants the 0 coefficients stated explicitly, but by their example (post #10), coefficients of "1" are omitted.
I forgot the other SUBSTITUTE. :oops:

=SUBSTITUTE(SUBSTITUTE(N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x")
 
Last edited:
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I forgot the other SUBSTITUTE. :oops:

=SUBSTITUTE(SUBSTITUTE(N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x")
Of course, the above formula is not exactly right either. :oops: This should be though...

=TRIM(SUBSTITUTE(SUBSTITUTE(" "&SUBSTITUTE(N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x"),"-1x"&CHAR(178),"-x"&CHAR(178)))
 
Upvote 0
=SUBSTITUTE(SUBSTITUTE(N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x")

To suppress +/1x², perhaps:

=TRIM(SUBSTITUTE(SUBSTITUTE(" "&N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x"))

Edit: Rick, you just beat me to it. But a quick look at your formula suggests you've identified another issue?
 
Last edited:
Upvote 0
Of course, the above formula is not exactly right either. :oops: This should be though...

=TRIM(SUBSTITUTE(SUBSTITUTE(" "&SUBSTITUTE(N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"+ -","- ")," 1x"," x"),"-1x"&CHAR(178),"-x"&CHAR(178)))
I think the following also works and it is a smidge "tighter"...

=SUBSTITUTE(MID(SUBSTITUTE(SUBSTITUTE("+ "&N(A1)&"x"&CHAR(178)&" + "&N(B1)&"x + "&N(C1),"-1x","-x"),"+ 1x","+ x"),3,99),"+ -","- ")

Edit Note: Keep in mind that with the exception of Messages 16, 18, 19 and 22, all of the messages back to Message #13 are responses to StephenCrump's suggestion in Message #13.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top