Apply a formula at (address) to a cell

T

tcebob

Rather than repeating formulas in (if) functions, is it possible to put them in a
reference cell? Some such function like "apply," except that one's taken. Let's say "Use."
So I could make the
formula in $C25 "=(if condition, (use $Z$47,A15),(use $Z$49,A15))." Meaning apply the
formula in $Z$49 to the data in A15.

Thanks

rs
 
R

Ron Rosenfeld

Rather than repeating formulas in (if) functions, is it possible to put them in a
reference cell? Some such function like "apply," except that one's taken. Let's say "Use."
So I could make the
formula in $C25 "=(if condition, (use $Z$47,A15),(use $Z$49,A15))." Meaning apply the
formula in $Z$49 to the data in A15.

Thanks

rs

A function can only return a value. It cannot change a value in another cell.
Using conditional formatting, it is possible for it to change a bit of the
appearance of a different cell (color, font, and the like) but it cannot cause
another cell to display a particular result.


--ron
 
T

tcebob

Not exactly what I was asking (or proposing). I'm standing in, say, B4, which contains the
function (use $Z$47,5). What I hope to happen is the function (use) reads the contents of
$Z$47 and, assuming it's a formula, applies 5 as the argument. If I had a brain I bet I
could write a routine to do that. But <sigh> I opted for wealthy instead.

rs

:
: >Rather than repeating formulas in (if) functions, is it possible to put them in a
: >reference cell? Some such function like "apply," except that one's taken. Let's say
"Use."
: >So I could make the
: >formula in $C25 "=(if condition, (use $Z$47,A15),(use $Z$49,A15))." Meaning apply the
: >formula in $Z$49 to the data in A15.
: >
: >Thanks
: >
: >rs
: >
:
: A function can only return a value. It cannot change a value in another cell.
: Using conditional formatting, it is possible for it to change a bit of the
: appearance of a different cell (color, font, and the like) but it cannot cause
: another cell to display a particular result.
:
:
: --ron
 
R

Ron Rosenfeld

I think that is doable using VBA. However, I think it would be fairly complex
as you would have to figure out how many arguments the formula in Z47 has,
where they are, and where to stick in the "5".

Not knowing why you want to set up your worksheet this way, I can only
speculate that perhaps the formulas are quite lengthy, and you want to shorten
them.

If that is the case, an alternative approach could be to write these lengthy
formulas as VBA UDF's, and then call those functions from within your IF
statement in B4:

=IF(logical_test_is_true, UDF_Z47(5), UDF_Z49(5))

Depending on the nature of the formulas in Z47 and Z49, it may be possible to
use NAME'd formulas.

Best,
--ron
------------------------------------------------


Not exactly what I was asking (or proposing). I'm standing in, say, B4, which contains the
function (use $Z$47,5). What I hope to happen is the function (use) reads the contents of
$Z$47 and, assuming it's a formula, applies 5 as the argument. If I had a brain I bet I
could write a routine to do that. But <sigh> I opted for wealthy instead.

rs

:
: >Rather than repeating formulas in (if) functions, is it possible to put them in a
: >reference cell? Some such function like "apply," except that one's taken. Let's say
"Use."
: >So I could make the
: >formula in $C25 "=(if condition, (use $Z$47,A15),(use $Z$49,A15))." Meaning apply the
: >formula in $Z$49 to the data in A15.
: >
: >Thanks
: >
: >rs
: >
:
: A function can only return a value. It cannot change a value in another cell.
: Using conditional formatting, it is possible for it to change a bit of the
: appearance of a different cell (color, font, and the like) but it cannot cause
: another cell to display a particular result.
:
:
: --ron

--ron
 
T

tcebob

Sounds very promising. UDF; Use Dat Flashlight? Oh, wait, User Defined Function I bet. I'm
on it.

thanks,

rs


:I think that is doable using VBA. However, I think it would be fairly complex
: as you would have to figure out how many arguments the formula in Z47 has,
: where they are, and where to stick in the "5".
:
: Not knowing why you want to set up your worksheet this way, I can only
: speculate that perhaps the formulas are quite lengthy, and you want to shorten
: them.
:
: If that is the case, an alternative approach could be to write these lengthy
: formulas as VBA UDF's, and then call those functions from within your IF
: statement in B4:
:
: =IF(logical_test_is_true, UDF_Z47(5), UDF_Z49(5))
:
: Depending on the nature of the formulas in Z47 and Z49, it may be possible to
: use NAME'd formulas.
:
: Best,
: --ron
: ------------------------------------------------
:
:
:
: >Not exactly what I was asking (or proposing). I'm standing in, say, B4, which contains
the
: >function (use $Z$47,5). What I hope to happen is the function (use) reads the contents
of
: >$Z$47 and, assuming it's a formula, applies 5 as the argument. If I had a brain I bet I
: >could write a routine to do that. But <sigh> I opted for wealthy instead.
: >
: >rs
: >
: >: >:
: >: >Rather than repeating formulas in (if) functions, is it possible to put them in a
: >: >reference cell? Some such function like "apply," except that one's taken. Let's say
: >"Use."
: >: >So I could make the
: >: >formula in $C25 "=(if condition, (use $Z$47,A15),(use $Z$49,A15))." Meaning apply
the
: >: >formula in $Z$49 to the data in A15.
: >: >
: >: >Thanks
: >: >
: >: >rs
: >: >
: >:
: >: A function can only return a value. It cannot change a value in another cell.
: >: Using conditional formatting, it is possible for it to change a bit of the
: >: appearance of a different cell (color, font, and the like) but it cannot cause
: >: another cell to display a particular result.
: >:
: >:
: >: --ron
: >
:
: --ron
 
Top