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

  • Thread starter Thread starter Karie
  • Start date Start date
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")
 
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.
 
Back
Top