How do I test a cell's formula (ex: Is this cell and Avg or a sum?

K

Karie

I want to be able to test the formula for a cell to see if it is an Average
or a Sum.

EX: ( if the first 4 characters of the forumula for A:3 = "=AVG", then B:3 =
"Average")

If not, can I designate cells by color. Then test for all cells that are a
certain color...

EX: (if Color of A:3 is red, then B:3 equals "Average")
 
J

JE McGimpsey

One way:

-Select Cell B1.
-Choose Insert/Name/Define
-Enter in 'Names in workbook:" box:

FormulaToLeft

-Enter in 'Refers to:' box:

=Get.Formula(A1)

-Click Add, OK

-in cell b3, enter:

=IF(ISERR(FIND("AVERAGE(",FormulaToLeft)),"","Average")

Or, to differentiate between AVERAGE and SUM:
=IF(ISERR(FIND("AVERAGE",FormulaToLeft)),
IF(ISERR(FIND("SUM(",FormulaToLeft)), "Neither","SUM"), "Average")

NOTE: Copying worksheets with references to XL4M commands (such as
Get.Formula()) to a new workbook will crash MacXL and Pre-WinXL03
applications.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top