How to combine formula parts from cells ??

moogeedoo

New Member
Joined
Apr 25, 2017
Messages
19
Dears is it able to concat a formula from cells
A1 = 5
B1 = +
C1 = 3
I want to put a formula in D1 to calculate A1, b1 and c1 in example 1 the result should be 8 so if i change the sign "+" in B1 to "-" the result in D1 should be 2 like example 2
example 1
1609448325185.png

example 2
1609448334585.png



thanks in advance
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
10,776
There is a way to create a formula from pieces like this, but it's complicated and not really a good idea. Or you could write a UDF and use the VBA Evaluate function. What makes more sense though is to make a list of the possible functions you want in B1, and create a function that does all of them, like this:

Book2
ABCD
15*38
25-32
35*38
45/31.666667
55^3125
Sheet2
Cell Formulas
RangeFormula
D1:D5D1=CHOOSE(MATCH(B1,{"+","-","/","*","^"},0),A1+C1,A1-C1,A1/C1,A1*C1,A1^C1)
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
10,776
I just realized that * can be a wildcard, which is why row 3 isn't right. To fix that, it's easiest to use "x" for the times operator instead. Also note that adding the "/" to cell B4 required putting a ' in front of it.

Book2
ABCD
15+38
25-32
35x315
45/31.666667
55^3125
Sheet2
Cell Formulas
RangeFormula
D1:D5D1=CHOOSE(MATCH(B1,{"+","-","/","x","^"},0),A1+C1,A1-C1,A1/C1,A1*C1,A1^C1)
 

moogeedoo

New Member
Joined
Apr 25, 2017
Messages
19
Thank U Mr. Eric for UR support but like this it will not be a good idea as U said, I will try it in another ways, Merry Christmas ❤️
 

Watch MrExcel Video

Forum statistics

Threads
1,128,018
Messages
5,628,167
Members
416,297
Latest member
Kara Payne

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
Top