+ Reply to Thread
Results 1 to 5 of 5

Explanation of formula

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Explanation of formula

    There is a clever piece of conditional formatting designed to show if a formula has been overwritten. It works by creating a range called (say) CellHasFormula and then entering =GET.CELLl(48,Indirect("rc",false)) in the reference box. In the cell you wish to conditionally format you enter =CellHasFormula. If the formula in that cell is overwritten, then the conditional formatting is displayed.

    Can someone explain to me how it works?

    Thanks
    Last edited by BRISBANEBOB; 04-02-2009 at 10:58 PM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Explanation of formula

    Good morning BRISBANEBOB

    This technique that you are describing is actually an old (OK, very old) XL4 macro. These are the days before VBA was invented, and actually predates my time with Excel that started with Excel 95.

    The problem with these old XL4 macros is that they can't be used directly in the worksheet - which is why you need to wrap the formula up in a named range. The object of the Get.Cell command is to return info about a particular cell, in pretty much the same way as todays Cell() command does - except far more powerful.

    The problem with these XL4 macros is that they are followed by parameters that are usually just numeric, so unless used frequently (very frequently) you wouldn't be able to follow what's happening. These old XL4 macros still pop up (albeit infrequently) on the forums because in some cases they can return information that can only be accessed by using a number of lines of VBA code.

    If you really need to know more, have a look at this link which contains the old help files for XL4 functions.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Re: Explanation of formula

    Thanks for the explanation. Is there a 'modern' equivalent which achieves the same result? i.e. uses conditional formatting to show if a cell does not have a formula in it?

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Explanation of formula

    Hi BRISBANEBOB
    Quote Originally Posted by BRISBANEBOB View Post
    Thanks for the explanation. Is there a 'modern' equivalent which achieves the same result? i.e. uses conditional formatting to show if a cell does not have a formula in it?
    Try putting the code below in as a function :
    Please Login or Register  to view this content.
    Now, select the cell you want to format, and go to Format > Conditional Formatting. Select FormulaIs and put this formula in :
    =IsFormula(A1)=TRUE
    and select your format. Now when A1 contains a formula your formatting will be applied. When it doesn't it won't.

    HTH

    DominicB

    Edit : Before anyone points it out, you don't actually need the =True bit - I usually just show it to help the user follow what's going on.
    Last edited by dominicb; 04-03-2009 at 03:30 AM.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Explanation of formula

    FWIW, I think most people would argue that given Conditional Formatting is (Super) Volatile (as is the UDF) you are often best served using a Worksheet_Change event to test if the altered (cell(s)) contain a formula or not and formatting the target (cells) accordingly... eg

    Please Login or Register  to view this content.
    Or you can make use of the often under utilised SpecialCells(xlCellTypeFormulas) method:

    Please Login or Register  to view this content.
    No need to iterate the above... all cells in the Target range are defaulted to Red and then subsequently any formulae cells present within the range have the background colour removed.
    Last edited by DonkeyOte; 04-03-2009 at 03:46 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1