Results 1 to 4 of 4

Thread: Variable Assignment

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    9

    Variable Assignment

    Quick question,
    I have a variable assigned as a Public integer:

    Public NIG As Integer

    which is assigned as an input from the user:

    NIG = InputBox("Please enter the Non Investment Grade limit for filter(deafult BBB-)", "NIG Limit", 610)

    I wish to use this in a logic argument:

    ActiveCell.FormulaR1C1 = _
    "=COUNTIF(Portfolio!R[-28]C[5]:R[591]C[5]," >= " & NIG &)/COUNT(Portfolio!R[-28]C[5]:R[591]C[5])%"

    But this is returning a "TRUE" - I was expecting a percentile figure!

    Any ideas?

    Cheers.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Variable Assignment

    try formatting the cell as percentage, as "True" is just boolean for 'not-zero'.

    also try removing the % at the end of the formula.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    9

    Thumbs down

    Thanks for the suggestion... still giving me the same answer!!!
    ..really weird !

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Variable Assignment

    ah, just realised you put the quotes in the wrong place, try this:
    ActiveCell.FormulaR1C1 = _
    "=COUNTIF(Portfolio!R[-28]C[5]:R[591]C[5], >= " & NIG & ")/COUNT(Portfolio!R[-28]C[5]:R[591]C[5])%"

    or maybe this (if the >= clause needs to be in quotes):
    ActiveCell.FormulaR1C1 = _
    "=COUNTIF(Portfolio!R[-28]C[5]:R[591]C[5], "" >= " & NIG & " "")/COUNT(Portfolio!R[-28]C[5]:R[591]C[5])%"

Posting Permissions

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



Click Here to Expand Forum to Full Width