excel function from another cell

Keebler

Board Regular
Joined
Dec 1, 2021
Messages
176
Office Version
  1. 2021
Platform
  1. Windows
Is it possible to use a formula to extract a function? (I am sure I am not asking this correctly)

so in column C i have a list of functions proper, lower, upper, etc
is it possible to use a formula to place that function in a formula to perform an action?

generally, if I were to use a function like proper I'd place it before any other function or command like
proper(vlookup(a1,$e$1:$k$99,5, false))

so,
is it possible to use a formula to change the function by referencing another cell?

such as c2, contains "Proper" and c4 contains "Upper"
c4&vlookup(a1,$e$1:$k$99,5, false)) = "Upper"widget55

(this fails obviously)
i know i can do this in VBA, but i have multiple lines to adjust, no two sheets have the same requirements exactly, and using a formula (that has been copied from row to row) and having a separate column with the function in it is precise and will do the job.

obviously, adding cell data is simple with this kind of reference. c4&a1 ("Upper"Widget) i was wondering if there is a more practical way to do this, rather than having to change every formula in every row, when in most cases, all that needs to change from row to row is the function (upper, lower, proper, etc)

thank you
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Chiming in to follow this in case I can learn something. However, I highly doubt it because I think the key words are function names but won't be interpreted as a built in function. I tried =C5(B3) where C5 contains Len, hoping it would be interpreted as =Len('string in B3') which would return 12 if it worked. Some functions (e.g. Len() ) will not allow you to skip over providing the values or cell references, so there's that too.

If you're going to copy a formula into cells on several rows, that seems rather tedious. Perhaps a userform would help, but that would involve vba for sure. What I'm thinking is a listbox to show the contents of a range. You choose (multiple?) list item(s) and then from a combo, a function to apply to the cell(s). Code would contain a Select Case block to deal with the function chosen. You'd probably do nested functions separately though (1st a lookup, then Upper).
HTH
 
Upvote 0
Not in a general sense. You'd have to handle all the possible "list of functions" explicitly, using your example - something like..

Book2
CD
1
2Lowerhello world
3UpperHELLO WORLD
4ProperHello World
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=LET(some_calc,"HeLLo WorLD",CHOOSE(MATCH(C2,{"Proper","Upper","Lower"},0),PROPER(some_calc),UPPER(some_calc),LOWER(some_calc)))
 
Upvote 0
Solution
FormR
that's BRILLIANT!!.
I will give that a whirl when i get back to the house... and let you know how it worked for me... THANK YOU

one question
can your variable "HeLLo WorLD" be a true variable? such as referencing data in a cell? some_calc, $d2? or better yet $A2 with the result in say, $e2?
 
Upvote 0
THANK YOU!!!
works perfectly!

here is what I did
=IF($AA15="","",LET(data1,$AA15,CHOOSE(MATCH($X15,{"lower","proper","upper"},0),LOWER(data1),PROPER(data1),UPPER(data1))))

column X has the "proper, upper, lower"
column AA has the data to be adjusted

and finally,
column A has the OUTPUT
(this is where the formula resides

Thank you very much!
 
Upvote 0
a little bit on the explanation (for anyone new to the LET command)

the "data1" variable is defined first [note the position after "LET(" ] <<<< LET(data1
then i defined WHERE the variable can find what I want processed [note where it is after the LET "LET(variable," ] <<<< LET(data1,$AA15
then, finally, i describe what i want done with the data that is loaded into the variable "data1" <This can be anything you decide <<<< LET(data1,$AA15,CHOOSE(MATCH($X15,{"lower","proper","upper"},0),LOWER(data1),PROPER(data1),UPPER(data1)))) NOTE that the "data1" variable is part of the function commands

in my case using the choose/match was perfect <yes, this can be a variable as well and/or a reference to a list elsewhere in the workbook


then simply placing the formula in the cell where i want the result to be performed/displayed
 
Upvote 0
THANK YOU!!!
works perfectly!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,867
Members
452,678
Latest member
will_simmo

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