If you don't want to use a UDF then you can use a named formula and
make use of the poorly-documented EVALUATE function (actually, this is
a throw-back to older versions of Excel).
As an example of how to use this, start with a new workbook and select
cell A1. If you are using XL2007 click on the Formulas tab and then
under the Defined Names section click on Define Name. If you are using
XL2003 or earlier, click on Insert | Name | Define. In both cases you
will then have a dialogue box, so put a suitable name in the top box
(eg text) and then in the Refers To section at the bottom (which will
show =Sheet1!$A$1) change this to:
=EVALUATE(Sheet1!$A$1)
Click OK to exit the dialogue box.
Now put some text in A1 which represents some Excel expression, eg
'2+3. In D1 you can enter the formula:
=text
(i.e. the name that you used to define A1), and you should see the
result 5 in D1. Note that you don't need the equals sign in A1, though
it will still work if you put:
'=2+3
You can also make use of cell references. Put 17 in B1 and 23 in C1
and then change the text in A1 to:
b1 + c1
and then the value displayed in D1 will change to 40 - it is
evaluating the string in A1 as if it were a valid Excel formula.
Can you see how you might apply this to your own situation?
Hope this helps.
Pete
On Sep 3, 8:05*am, exceluser <ifmcqy7aias...@yahoo.com> wrote:
> Pete,
>
> * *You're absolutely right.
>
> * *What I'm trying to do with Excel is create a query that is more
> suited to an SQL client and a relational database and not a
> spreadsheet.
>
> * *But that only applies if I'm trying to use Excel with regular
> functions and not UDFs or macros - which is what I was hoping to do.
>
> * *As Eric mentioned above, the key is inserting an equal sign in
> front of the text to get Excel to recognize the cell's contents as a
> formula.
>
> * *Is that what your UDF above would do ?
>
> * *Since, I've never used or created a UDF, I wouldn't know how to
> register the code you wrote above.
>
> * *But at least it would be easy to maintain. 
>
> Exceluser