+ Reply to Thread
Results 1 to 4 of 4

Reading formulae in a different cell

Hybrid View

  1. #1
    Albert
    Guest

    Reading formulae in a different cell

    If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
    reference or find the 3rd argument in the formula from another cell. When I
    use any formula that references A1 it always uses the result of the formula
    (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).

    Thanks
    --

    Albert

  2. #2
    Niek Otten
    Guest

    Re: Reading formulae in a different cell

    Hi Albert,

    You can use this User Defined Function (UDF):

    Function ShowFormula(a As Range)
    If Application.ReferenceStyle = xlR1C1 _
    Then ShowFormula = a.FormulaR1C1 _
    Else: ShowFormula = a.Formula
    End Function


    --
    Kind regards,

    Niek Otten

    "Albert" <Albert@discussions.microsoft.com> wrote in message news:C358C6DE-59C5-431B-9466-0D85EBAB63A0@microsoft.com...
    | If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
    | reference or find the 3rd argument in the formula from another cell. When I
    | use any formula that references A1 it always uses the result of the formula
    | (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).
    |
    | Thanks
    | --
    |
    | Albert



  3. #3
    Albert
    Guest

    Re: Reading formulae in a different cell

    Many thanks for your help.
    --
    Albert


    "Niek Otten" wrote:

    > Hi Albert,
    >
    > You can use this User Defined Function (UDF):
    >
    > Function ShowFormula(a As Range)
    > If Application.ReferenceStyle = xlR1C1 _
    > Then ShowFormula = a.FormulaR1C1 _
    > Else: ShowFormula = a.Formula
    > End Function
    >
    >
    > --
    > Kind regards,
    >
    > Niek Otten
    >
    > "Albert" <Albert@discussions.microsoft.com> wrote in message news:C358C6DE-59C5-431B-9466-0D85EBAB63A0@microsoft.com...
    > | If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
    > | reference or find the 3rd argument in the formula from another cell. When I
    > | use any formula that references A1 it always uses the result of the formula
    > | (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).
    > |
    > | Thanks
    > | --
    > |
    > | Albert
    >
    >
    >


  4. #4
    Gary''s Student
    Guest

    RE: Reading formulae in a different cell

    You could use a UDF to display the formula as a string and then parse the
    string with MID(), LEFT(), etc.:

    Function textofformula(r As Range) As String
    textofformula = r.Formula
    End Function



    and use like =textofformula(A1)
    --
    Gary's Student


    "Albert" wrote:

    > If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
    > reference or find the 3rd argument in the formula from another cell. When I
    > use any formula that references A1 it always uses the result of the formula
    > (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).
    >
    > Thanks
    > --
    >
    > Albert


+ 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