PDA

Click to See Complete Forum and Search --> : Variable Assignment


mp16
Jan 30th, 2004, 03:10 AM
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.

si_the_geek
Jan 30th, 2004, 04:14 AM
try formatting the cell as percentage, as "True" is just boolean for 'not-zero'.

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

mp16
Jan 30th, 2004, 04:17 AM
Thanks for the suggestion... still giving me the same answer!!!
..really weird !

si_the_geek
Jan 30th, 2004, 04:49 AM
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])%"