Results 1 to 5 of 5
  1. #1
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Refer to Custom Document Property in Formula (XP)

    I have built a "Custom Document Property" called FirstMonth. Can I use this in an IF statement such as
    <pre>=IF(FirstMonth=D4, "ACTUAL","FORECAST")</pre>

    Apparently I have the syntax wrong.
    Alan

  2. #2
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Beddau, Mid Glamorgan, Wales
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to Custom Document Property in Formula (XP)

    Alan:

    Have you linked your custom property to a Named Range of FirstMonth? If so, =IF(D4=FirstMonth,"ACTUAL","FORECAST") will work.

    Incidentally, you shouldn't have a space after your first comma.

    Tony.
    Regards,

    Tony
    [s] [/s]
    www.SylviArtist.com

  3. #3
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Refer to Custom Document Property in Formula (XP)

    No, the CustomProperty is updated by a program that is run several times a week. The user chooses what month is considered the last actual in a dialog and the Property is updated.

    That extra space was thrown in by this editor, not manually.
    Alan

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Refer to Custom Document Property in Formula (XP)

    Linking a property to a named range, as proposed by Tony, is probably the easiest solution. If you don't want that, you can create a custom function in a standard module:

    Function GetProperty(PropertyName As String)
    GetProperty = ActiveWorkbook.CustomDocumentProperties(PropertyNa me).Value
    End Function

    Use this to get the value of a property:

    =IF(GetProperty("FirstMonth")=D4,"ACTUAL","FORECAS T")

  5. #5
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Refer to Custom Document Property in Formula (XP)

    Perfect!
    Alan

Posting Permissions

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