+ Reply to Thread
Results 1 to 8 of 8

Thread: Conditional Formatting & UDF

  1. #1
    Registered User
    Join Date
    03-02-2010
    Location
    London, UK
    MS-Off Ver
    Excel 2003
    Posts
    35

    Conditional Formatting & UDF

    Please help as I'm trying to accomplish the following:
    • inputing the formulat in Column F to the Conditional Formatting but it just wouldn't accept and it's throwing up an error message. I think this has got something to do with the WEEKNUM function as it's part of the Analysis ToolPak add-in. I know I can indeed leave the column as it is or perhaps hide it, but I want to embed the formula in Conditional Formatting so that if a row is inserted, the CF is carried through. Is there any other formula to get round this?
    • create a UDF function perhaps to display the formula as text from another cell, such as Column E to Column F
    I have attached an sample file for this.
    Attached Files Attached Files
    Last edited by e_lad; 03-05-2010 at 09:25 AM.

  2. #2
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,784

    Re: Conditional Formatting & UDF

    name the formula
    insert/name /define
    choose a name say "weeks"
    in the refers to box put
    =ISEVEN(WEEKNUM(Sheet1!$A4))
    then use formula is = weeks in the conditional format
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Conditional Formatting & UDF

    @e_lad ... I did add in a post that ISEVEN is also in the ATP and can be replaced with a Mod but given Martin's suggestion does what you want I removed said post as it wasn't relevant.

    @Martin... I tried to dish the rep but it says I have to spread the love.

  4. #4
    Registered User
    Join Date
    03-02-2010
    Location
    London, UK
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Conditional Formatting & UDF

    I'm glad I found this forum...what I would do without the help from you guys.

    @DO & Martin...Did you get a chance to look at the 2nd question too? I'm looking at a formula that would allow to turn the formula of the adjacent cell to a text to distplay. Doing this through Options Menu would turn the entire spreadsheet into formula!

  5. #5
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Conditional Formatting & UDF

    You can use a UDF or you can make use of the old XLM calls via a Name

    If you prefer the Name route ... create a new name:

    Name: _Formula
    RefersTo: =GET.CELL(INDIRECT("RC[-1]",FALSE))
    In the cell you want to return the adjacent formula (immediate left) to:

    =_Formula
    A UDF would be more practical however

    Function GETFORMULA(rngCell As Range) As String
    GETFORMULA = rngCell(1).Formula
    End Function
    called from a cell like

    =GETFORMULA(E1)
    where E1 contains the formula.

  6. #6
    Registered User
    Join Date
    03-02-2010
    Location
    London, UK
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Conditional Formatting & UDF

    DO...the Name method can be quite useful as it does not requiire the macro to be enabled however, it seems to throw uip the #VALUE! error for some reason.

  7. #7
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Conditional Formatting & UDF

    What a spanner I am ... it does help if I actually include the appropriate function within the GET.CELL call... ie 6:

    RefersTo: =GET.CELL(6,INDIRECT("RC[-1]",FALSE))
    In this case you could also avoid using INDIRECT ... so if the name is be to used say in F2 to relate to E2 then with F2 active cell define the name as:

    RefersTo: =GET.CELL(6,E2)
    Last edited by DonkeyOte; 03-05-2010 at 08:19 AM. Reason: added non-volatile approach

  8. #8
    Registered User
    Join Date
    03-02-2010
    Location
    London, UK
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Conditional Formatting & UDF

    DO...thanks again

+ 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.2.0