Cell Temp Variable

bmgpub

New Member
Joined
May 5, 2011
Messages
2
I have a complex cell function of the form:

=if(iserr(complex_thing), error_message, complex_thing)

Is there a way to avoid the function performing the "complex_thing" twice?
Is Excel's internal processing smart enough to pick up on this?

Ideally, I would like to use a temp variable such as
=if(iserr(tmpv=complex_thing), error_message, tmpv)
or some such syntax as
=let(tmpv,complex_thing)&if(iserr(tmpv), error_message, tmpv)

This is just an example. I've run across a number of situations where I'm using a check for validity before using the results where being able to store the results temporarily and only within the context of the cell's function calculation would be beneficial (at least performance wise).

Anyone also need this? Anyone have a workaround?
Can we lobby Microsoft to add such a feature?

Mason
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
There is such a thing now, a function called IFERROR. If you don't have it, then use another column to calculate the complex function, then you can reference that column so that "complex function" gets calculated only once.
 
Upvote 0
Ok, That may be useful for error situations, but I was just using error as an example. What if it were

=if(and(complex_thing>1,complex_thing<10), complex_thing, other_thing)

I undestand that using an additional cell will work, but having so many
interim calc cells gets messy if every cell in a range has to have one or more "temp" cells and you have to string a compound decision tree across a bunch of things.
 
Upvote 0
The addin MoreFunc.xll has two functions called GETV() and SETV() which could be used then:

IF(AND(SETV(complex)>1, GETV()<10), GETV(), other_thing)
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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