Function to split formula contents of a cell to columns

acurious1982

New Member
Joined
Sep 7, 2013
Messages
2
Hi,

OK, imagine this simple scenario:

Cell A1 says:
=5*4

now in cell A2 I want to only be able to extraact the charecter "5"

I know how to use Text to Split feature, but I dont neither wanna use that feature nor any VBA programing please!

I know how to use search, mid, left, right, etc and all these functions but not if I wanna extract a part of a cell which has a formula, that simply doesnt work!!!

I appreaciate any help :)

thanks very much in advance
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I don't think it is possible to do this with a built in function. The function acts on the cells value property, not its formula property, so it won't even see how the value is created.

You could do this using a User Defined Function (UDF), but you have to write the UDF in VBA. A simple UDF to do what you proposed is (in a standard VBA code module):

Code:
Function get_num(rng As Range)
get_num = Evaluate(Split(rng.Formula, "*")(0))
End Function

Used as
A2: =get_num(A1)
 
Upvote 0
Alternatively, assuming your formula is in A1, go to Name Manager and create a new name, say Get_Formula,and enter this in the Refers to: box:

=GET.CELL(6,Sheet1!A1)

Exit Name Manager. Then, in B1, enter this formula:

=MID(Get_Formula,FIND("=",Get_Formula)+1,1)

Obviously you can amend the MID construction to something a bit more dynamic (e.g. if the desired extraction is not always of length one), but since you said you have experience in using these sorts of formulas I will leave that to you.

Regards
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,122
Members
452,545
Latest member
boybenqn

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