Page 1 of 1
ERASING NEG FIGURES
Posted: Fri Feb 11, 2005 3:29 am
by URSULE
As a result of calculation I get a serie which has positive and negative figures.I would like to eliminate for a PRINT of thes values, all the negatives figures (I don't need them).ABS gives the figures without sign and is not the answer. How can I do?
Posted: Fri Feb 11, 2005 7:42 am
by Z!re
If using an array:
Code: Select all
For a = 0 To arrLen
If Arr(a) >= 0 Then Print Arr(a)
Next
Posted: Fri Feb 11, 2005 7:48 am
by Mitth'raw'nuruodo
Ok, Ummm here we go:
It easy
Do this:
Code: Select all
arrayname2i = 0
FOR i = LBOUND(arrayname) TO UBOUND(arrayname)
IF i >= 0 THEN arrayname2i = arrayname2i + 1 : arrayname2(arrayname2i) = arrayname(i)
NEXT i
Or (my pref):
Code: Select all
'when you want to PRINT it
FOR i = LBOUND(arrayname) TO UBOUND(arrayname)
IF i >= 0 THEN PRINT arrayname(i)
NEXT i
The first one takes a series of values from arrayname and transfers only the ones that are 0 or postitive to arrayname2. Just have arrayname2 have the same range as arrayname. And use arrayname2 for now on or transfer the vals back to arrayname AFTER you clear it first.
The second one PRINTs out the values in arrayname only those that are 0 or positive. This way I preferr.
Well if that didn't answer you question then please explain more or provide source please...
Hey Rattrap I beat you on this one HA!

Posted: Fri Feb 11, 2005 7:49 am
by Mitth'raw'nuruodo
Darn Z!re posted before me...She wasn't here when I looked at it though...Sorry Z!re for just saying what you said in more words....heh...
Posted: Fri Feb 11, 2005 12:01 pm
by Rattrapmax6

He posted a few soconds b4 you, oh well,.. I'm glad you 2 it first, I'd had to ponder on this one for a min,.

,. now I no have to, heh heh,.
I'm still confused, Z!re, you a boy or girl? I saw the comment, I thought you were commenting that QB Gals EM had MID$(email,,4) = "Lord" in it,..
Doesn't matter either way, I'm just screwed up, and liked to be set strait with a solid answer.

Posted: Fri Feb 11, 2005 3:02 pm
by Mitth'raw'nuruodo
Ya Z!re lets set this strait you a guy or girl?