Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-2007, 05:12 PM
Maciej Grzywna
 
Posts: n/a
Counting negative values

Hi All,

I'd be very grateful if someone could help me with this.
I have a following table:

No, Company,Var1
12, ZXC, 6
12, ZXC, 4
12, ZXC, -3
34, AAC, 2
34, AAC, 4
56, BBR, -5
78, CCV, -4
78, CCV, -12

What I need is another column with some variable that would turn e.g. 1 when
company has at least one row with negative value of Var1 and 0 if not. In
other words, i'd like to get:

No, Company,Var1, Var2
12, ZXC, 6, 1
12, ZXC, 4, 1
12, ZXC, -3, 1
34, AAC, 2, 0
34, AAC, 4, 0
56, BBR, -5, 1
78, CCV, -4, 1
78, CCV, -12, 1

I have to add that I have about 9000 rows and i'm using excel 2003.

Thanks
Maciek


Reply With Quote
  #2 (permalink)  
Old 11-26-2007, 05:39 PM
Peo Sjoblom
 
Posts: n/a
Re: Counting negative values

If that's the case why do you get 1 for the first 2 values in your example?

=-1*(C2<0)

where C2 would be the first Var1

copy down


--


Regards,


Peo Sjoblom



"Maciej Grzywna" <relever@wp.pl> wrote in message
news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
> Hi All,
>
> I'd be very grateful if someone could help me with this.
> I have a following table:
>
> No, Company,Var1
> 12, ZXC, 6
> 12, ZXC, 4
> 12, ZXC, -3
> 34, AAC, 2
> 34, AAC, 4
> 56, BBR, -5
> 78, CCV, -4
> 78, CCV, -12
>
> What I need is another column with some variable that would turn e.g. 1
> when company has at least one row with negative value of Var1 and 0 if
> not. In other words, i'd like to get:
>
> No, Company,Var1, Var2
> 12, ZXC, 6, 1
> 12, ZXC, 4, 1
> 12, ZXC, -3, 1
> 34, AAC, 2, 0
> 34, AAC, 4, 0
> 56, BBR, -5, 1
> 78, CCV, -4, 1
> 78, CCV, -12, 1
>
> I have to add that I have about 9000 rows and i'm using excel 2003.
>
> Thanks
> Maciek
>



Reply With Quote
  #3 (permalink)  
Old 11-26-2007, 06:25 PM
Maciej Grzywna
 
Posts: n/a
Re: Counting negative values

Hi Peo,

in my example first 3 values concern the same company, and that's the case.
When at least one value "within" the company is negative then I want all
three rows to have 1 in the fourth column.
I hope that will help.

Thanks
Maciek

"Peo Sjoblom" <terre08@mvps.org> wrote in message
news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
> If that's the case why do you get 1 for the first 2 values in your
> example?
>
> =-1*(C2<0)
>
> where C2 would be the first Var1
>
> copy down
>
>
> --
>
>
> Regards,
>
>
> Peo Sjoblom
>
>
>
> "Maciej Grzywna" <relever@wp.pl> wrote in message
> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>> Hi All,
>>
>> I'd be very grateful if someone could help me with this.
>> I have a following table:
>>
>> No, Company,Var1
>> 12, ZXC, 6
>> 12, ZXC, 4
>> 12, ZXC, -3
>> 34, AAC, 2
>> 34, AAC, 4
>> 56, BBR, -5
>> 78, CCV, -4
>> 78, CCV, -12
>>
>> What I need is another column with some variable that would turn e.g. 1
>> when company has at least one row with negative value of Var1 and 0 if
>> not. In other words, i'd like to get:
>>
>> No, Company,Var1, Var2
>> 12, ZXC, 6, 1
>> 12, ZXC, 4, 1
>> 12, ZXC, -3, 1
>> 34, AAC, 2, 0
>> 34, AAC, 4, 0
>> 56, BBR, -5, 1
>> 78, CCV, -4, 1
>> 78, CCV, -12, 1
>>
>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>
>> Thanks
>> Maciek
>>

>
>
>



Reply With Quote
  #4 (permalink)  
Old 11-26-2007, 08:01 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Counting negative values

Give this formula a try...

=--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)

Rick


"Maciej Grzywna" <relever@wp.pl> wrote in message
news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
> Hi Peo,
>
> in my example first 3 values concern the same company, and that's the
> case. When at least one value "within" the company is negative then I want
> all three rows to have 1 in the fourth column.
> I hope that will help.
>
> Thanks
> Maciek
>
> "Peo Sjoblom" <terre08@mvps.org> wrote in message
> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>> If that's the case why do you get 1 for the first 2 values in your
>> example?
>>
>> =-1*(C2<0)
>>
>> where C2 would be the first Var1
>>
>> copy down
>>
>>
>> --
>>
>>
>> Regards,
>>
>>
>> Peo Sjoblom
>>
>>
>>
>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>> Hi All,
>>>
>>> I'd be very grateful if someone could help me with this.
>>> I have a following table:
>>>
>>> No, Company,Var1
>>> 12, ZXC, 6
>>> 12, ZXC, 4
>>> 12, ZXC, -3
>>> 34, AAC, 2
>>> 34, AAC, 4
>>> 56, BBR, -5
>>> 78, CCV, -4
>>> 78, CCV, -12
>>>
>>> What I need is another column with some variable that would turn e.g. 1
>>> when company has at least one row with negative value of Var1 and 0 if
>>> not. In other words, i'd like to get:
>>>
>>> No, Company,Var1, Var2
>>> 12, ZXC, 6, 1
>>> 12, ZXC, 4, 1
>>> 12, ZXC, -3, 1
>>> 34, AAC, 2, 0
>>> 34, AAC, 4, 0
>>> 56, BBR, -5, 1
>>> 78, CCV, -4, 1
>>> 78, CCV, -12, 1
>>>
>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>
>>> Thanks
>>> Maciek
>>>

>>
>>
>>

>
>


Reply With Quote
  #5 (permalink)  
Old 11-26-2007, 08:14 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Counting negative values

Actually, use this equation instead (it suppresses the 0 if there is no
number in column C)...

=IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))

And, of course, you can change the ranges as required by your data (but note
that you can copy the formula down passed your last piece of data to account
for future entries).

Rick


"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
> Give this formula a try...
>
> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>
> Rick
>
>
> "Maciej Grzywna" <relever@wp.pl> wrote in message
> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>> Hi Peo,
>>
>> in my example first 3 values concern the same company, and that's the
>> case. When at least one value "within" the company is negative then I
>> want all three rows to have 1 in the fourth column.
>> I hope that will help.
>>
>> Thanks
>> Maciek
>>
>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>> If that's the case why do you get 1 for the first 2 values in your
>>> example?
>>>
>>> =-1*(C2<0)
>>>
>>> where C2 would be the first Var1
>>>
>>> copy down
>>>
>>>
>>> --
>>>
>>>
>>> Regards,
>>>
>>>
>>> Peo Sjoblom
>>>
>>>
>>>
>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>> Hi All,
>>>>
>>>> I'd be very grateful if someone could help me with this.
>>>> I have a following table:
>>>>
>>>> No, Company,Var1
>>>> 12, ZXC, 6
>>>> 12, ZXC, 4
>>>> 12, ZXC, -3
>>>> 34, AAC, 2
>>>> 34, AAC, 4
>>>> 56, BBR, -5
>>>> 78, CCV, -4
>>>> 78, CCV, -12
>>>>
>>>> What I need is another column with some variable that would turn e.g. 1
>>>> when company has at least one row with negative value of Var1 and 0 if
>>>> not. In other words, i'd like to get:
>>>>
>>>> No, Company,Var1, Var2
>>>> 12, ZXC, 6, 1
>>>> 12, ZXC, 4, 1
>>>> 12, ZXC, -3, 1
>>>> 34, AAC, 2, 0
>>>> 34, AAC, 4, 0
>>>> 56, BBR, -5, 1
>>>> 78, CCV, -4, 1
>>>> 78, CCV, -12, 1
>>>>
>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>
>>>> Thanks
>>>> Maciek
>>>>
>>>
>>>
>>>

>>
>>

>


Reply With Quote
  #6 (permalink)  
Old 11-26-2007, 09:00 PM
Maciej Grzywna
 
Posts: n/a
Re: Counting negative values

Rick

Thank you very much for your help.

Maciek

"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
message news:eiMlSjGMIHA.1184@TK2MSFTNGP04.phx.gbl...
> Actually, use this equation instead (it suppresses the 0 if there is no
> number in column C)...
>
> =IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))
>
> And, of course, you can change the ranges as required by your data (but
> note that you can copy the formula down passed your last piece of data to
> account for future entries).
>
> Rick
>
>
> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
> message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
>> Give this formula a try...
>>
>> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>>
>> Rick
>>
>>
>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>> Hi Peo,
>>>
>>> in my example first 3 values concern the same company, and that's the
>>> case. When at least one value "within" the company is negative then I
>>> want all three rows to have 1 in the fourth column.
>>> I hope that will help.
>>>
>>> Thanks
>>> Maciek
>>>
>>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>>> If that's the case why do you get 1 for the first 2 values in your
>>>> example?
>>>>
>>>> =-1*(C2<0)
>>>>
>>>> where C2 would be the first Var1
>>>>
>>>> copy down
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> Regards,
>>>>
>>>>
>>>> Peo Sjoblom
>>>>
>>>>
>>>>
>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>>> Hi All,
>>>>>
>>>>> I'd be very grateful if someone could help me with this.
>>>>> I have a following table:
>>>>>
>>>>> No, Company,Var1
>>>>> 12, ZXC, 6
>>>>> 12, ZXC, 4
>>>>> 12, ZXC, -3
>>>>> 34, AAC, 2
>>>>> 34, AAC, 4
>>>>> 56, BBR, -5
>>>>> 78, CCV, -4
>>>>> 78, CCV, -12
>>>>>
>>>>> What I need is another column with some variable that would turn e.g.
>>>>> 1 when company has at least one row with negative value of Var1 and 0
>>>>> if not. In other words, i'd like to get:
>>>>>
>>>>> No, Company,Var1, Var2
>>>>> 12, ZXC, 6, 1
>>>>> 12, ZXC, 4, 1
>>>>> 12, ZXC, -3, 1
>>>>> 34, AAC, 2, 0
>>>>> 34, AAC, 4, 0
>>>>> 56, BBR, -5, 1
>>>>> 78, CCV, -4, 1
>>>>> 78, CCV, -12, 1
>>>>>
>>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>>
>>>>> Thanks
>>>>> Maciek
>>>>>
>>>>
>>>>
>>>>
>>>
>>>

>>

>
>



Reply With Quote
  #7 (permalink)  
Old 11-26-2007, 09:10 PM
RAGdyer
 
Posts: n/a
Re: Counting negative values

Rick really meant to include the absolutes:

=IF(C1="","",--(SUMPRODUCT(($C$1:$C$100<0)*($B$1:$B$100=B1))>0))
--
Regards,

RD
----------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
----------------------------------------------------------------------------------


"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
message news:eiMlSjGMIHA.1184@TK2MSFTNGP04.phx.gbl...
> Actually, use this equation instead (it suppresses the 0 if there is no
> number in column C)...
>
> =IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))
>
> And, of course, you can change the ranges as required by your data (but
> note that you can copy the formula down passed your last piece of data to
> account for future entries).
>
> Rick
>
>
> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
> message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
>> Give this formula a try...
>>
>> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>>
>> Rick
>>
>>
>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>> Hi Peo,
>>>
>>> in my example first 3 values concern the same company, and that's the
>>> case. When at least one value "within" the company is negative then I
>>> want all three rows to have 1 in the fourth column.
>>> I hope that will help.
>>>
>>> Thanks
>>> Maciek
>>>
>>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>>> If that's the case why do you get 1 for the first 2 values in your
>>>> example?
>>>>
>>>> =-1*(C2<0)
>>>>
>>>> where C2 would be the first Var1
>>>>
>>>> copy down
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> Regards,
>>>>
>>>>
>>>> Peo Sjoblom
>>>>
>>>>
>>>>
>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>>> Hi All,
>>>>>
>>>>> I'd be very grateful if someone could help me with this.
>>>>> I have a following table:
>>>>>
>>>>> No, Company,Var1
>>>>> 12, ZXC, 6
>>>>> 12, ZXC, 4
>>>>> 12, ZXC, -3
>>>>> 34, AAC, 2
>>>>> 34, AAC, 4
>>>>> 56, BBR, -5
>>>>> 78, CCV, -4
>>>>> 78, CCV, -12
>>>>>
>>>>> What I need is another column with some variable that would turn e.g.
>>>>> 1 when company has at least one row with negative value of Var1 and 0
>>>>> if not. In other words, i'd like to get:
>>>>>
>>>>> No, Company,Var1, Var2
>>>>> 12, ZXC, 6, 1
>>>>> 12, ZXC, 4, 1
>>>>> 12, ZXC, -3, 1
>>>>> 34, AAC, 2, 0
>>>>> 34, AAC, 4, 0
>>>>> 56, BBR, -5, 1
>>>>> 78, CCV, -4, 1
>>>>> 78, CCV, -12, 1
>>>>>
>>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>>
>>>>> Thanks
>>>>> Maciek
>>>>>
>>>>
>>>>
>>>>
>>>
>>>

>>

>



Reply With Quote
  #8 (permalink)  
Old 11-26-2007, 10:12 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Counting negative values

Yes, you are right... I did forget about that; although the formula would
still work as I posted it provided there were no gaps in the data and the
data wasn't more than half the number of cells in a column. Of course, the
absolute ranges are more practical. I would point out, however, that the
columns do not really need to be absolute as the formulas are being copied
down (it doesn't hurt to make them absolute, but it isn't mandatory). Also,
because the first cell in the range is being compared to itself, the first
row of the range does not really need to be absolute either. Had I realized
my mistake in leaving out the absolute ranges, this is how I would have
posted the formula...

=IF(C1="","",--(SUMPRODUCT((C1:C$100<0)*(B1:B$100=B1))>0))

But, of course, your posted correction would work fine also.

With all that said, thank you for catching my omission and alerting me to
it... I really appreciate that.

Rick


"RAGdyer" <RAGdyer@CUTOUTmsn.com> wrote in message
news:%23h7O9CHMIHA.4228@TK2MSFTNGP02.phx.gbl...
> Rick really meant to include the absolutes:
>
> =IF(C1="","",--(SUMPRODUCT(($C$1:$C$100<0)*($B$1:$B$100=B1))>0))
> --
> Regards,
>
> RD
> ----------------------------------------------------------------------------------
> Please keep all correspondence within the Group, so all may benefit !
> ----------------------------------------------------------------------------------
>
>
> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
> message news:eiMlSjGMIHA.1184@TK2MSFTNGP04.phx.gbl...
>> Actually, use this equation instead (it suppresses the 0 if there is no
>> number in column C)...
>>
>> =IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))
>>
>> And, of course, you can change the ranges as required by your data (but
>> note that you can copy the formula down passed your last piece of data to
>> account for future entries).
>>
>> Rick
>>
>>
>> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
>> message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
>>> Give this formula a try...
>>>
>>> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>>>
>>> Rick
>>>
>>>
>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>>> Hi Peo,
>>>>
>>>> in my example first 3 values concern the same company, and that's the
>>>> case. When at least one value "within" the company is negative then I
>>>> want all three rows to have 1 in the fourth column.
>>>> I hope that will help.
>>>>
>>>> Thanks
>>>> Maciek
>>>>
>>>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>>>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>>>> If that's the case why do you get 1 for the first 2 values in your
>>>>> example?
>>>>>
>>>>> =-1*(C2<0)
>>>>>
>>>>> where C2 would be the first Var1
>>>>>
>>>>> copy down
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>>
>>>>> Peo Sjoblom
>>>>>
>>>>>
>>>>>
>>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>>>> Hi All,
>>>>>>
>>>>>> I'd be very grateful if someone could help me with this.
>>>>>> I have a following table:
>>>>>>
>>>>>> No, Company,Var1
>>>>>> 12, ZXC, 6
>>>>>> 12, ZXC, 4
>>>>>> 12, ZXC, -3
>>>>>> 34, AAC, 2
>>>>>> 34, AAC, 4
>>>>>> 56, BBR, -5
>>>>>> 78, CCV, -4
>>>>>> 78, CCV, -12
>>>>>>
>>>>>> What I need is another column with some variable that would turn e.g.
>>>>>> 1 when company has at least one row with negative value of Var1 and 0
>>>>>> if not. In other words, i'd like to get:
>>>>>>
>>>>>> No, Company,Var1, Var2
>>>>>> 12, ZXC, 6, 1
>>>>>> 12, ZXC, 4, 1
>>>>>> 12, ZXC, -3, 1
>>>>>> 34, AAC, 2, 0
>>>>>> 34, AAC, 4, 0
>>>>>> 56, BBR, -5, 1
>>>>>> 78, CCV, -4, 1
>>>>>> 78, CCV, -12, 1
>>>>>>
>>>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>>>
>>>>>> Thanks
>>>>>> Maciek
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>

>>

>
>


Reply With Quote
  #9 (permalink)  
Old 11-27-2007, 01:37 PM
RAGdyer
 
Posts: n/a
Re: Counting negative values

Ahhh ... Yes ... BUT ... It's so much more easier to simply hit <F4> once in
each relevant reference!<bg>
--
Regards,

RD
----------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
----------------------------------------------------------------------------------

"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
message news:%23TzhdlHMIHA.820@TK2MSFTNGP06.phx.gbl...
> Yes, you are right... I did forget about that; although the formula would
> still work as I posted it provided there were no gaps in the data and the
> data wasn't more than half the number of cells in a column. Of course, the
> absolute ranges are more practical. I would point out, however, that the
> columns do not really need to be absolute as the formulas are being copied
> down (it doesn't hurt to make them absolute, but it isn't mandatory).
> Also, because the first cell in the range is being compared to itself, the
> first row of the range does not really need to be absolute either. Had I
> realized my mistake in leaving out the absolute ranges, this is how I
> would have posted the formula...
>
> =IF(C1="","",--(SUMPRODUCT((C1:C$100<0)*(B1:B$100=B1))>0))
>
> But, of course, your posted correction would work fine also.
>
> With all that said, thank you for catching my omission and alerting me to
> it... I really appreciate that.
>
> Rick
>
>
> "RAGdyer" <RAGdyer@CUTOUTmsn.com> wrote in message
> news:%23h7O9CHMIHA.4228@TK2MSFTNGP02.phx.gbl...
>> Rick really meant to include the absolutes:
>>
>> =IF(C1="","",--(SUMPRODUCT(($C$1:$C$100<0)*($B$1:$B$100=B1))>0))
>> --
>> Regards,
>>
>> RD
>> ----------------------------------------------------------------------------------
>> Please keep all correspondence within the Group, so all may benefit !
>> ----------------------------------------------------------------------------------
>>
>>
>> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
>> message news:eiMlSjGMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>> Actually, use this equation instead (it suppresses the 0 if there is no
>>> number in column C)...
>>>
>>> =IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))
>>>
>>> And, of course, you can change the ranges as required by your data (but
>>> note that you can copy the formula down passed your last piece of data
>>> to account for future entries).
>>>
>>> Rick
>>>
>>>
>>> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
>>> message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
>>>> Give this formula a try...
>>>>
>>>> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>>>>
>>>> Rick
>>>>
>>>>
>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>>>> Hi Peo,
>>>>>
>>>>> in my example first 3 values concern the same company, and that's the
>>>>> case. When at least one value "within" the company is negative then I
>>>>> want all three rows to have 1 in the fourth column.
>>>>> I hope that will help.
>>>>>
>>>>> Thanks
>>>>> Maciek
>>>>>
>>>>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>>>>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>>>>> If that's the case why do you get 1 for the first 2 values in your
>>>>>> example?
>>>>>>
>>>>>> =-1*(C2<0)
>>>>>>
>>>>>> where C2 would be the first Var1
>>>>>>
>>>>>> copy down
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>>
>>>>>> Peo Sjoblom
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I'd be very grateful if someone could help me with this.
>>>>>>> I have a following table:
>>>>>>>
>>>>>>> No, Company,Var1
>>>>>>> 12, ZXC, 6
>>>>>>> 12, ZXC, 4
>>>>>>> 12, ZXC, -3
>>>>>>> 34, AAC, 2
>>>>>>> 34, AAC, 4
>>>>>>> 56, BBR, -5
>>>>>>> 78, CCV, -4
>>>>>>> 78, CCV, -12
>>>>>>>
>>>>>>> What I need is another column with some variable that would turn
>>>>>>> e.g. 1 when company has at least one row with negative value of Var1
>>>>>>> and 0 if not. In other words, i'd like to get:
>>>>>>>
>>>>>>> No, Company,Var1, Var2
>>>>>>> 12, ZXC, 6, 1
>>>>>>> 12, ZXC, 4, 1
>>>>>>> 12, ZXC, -3, 1
>>>>>>> 34, AAC, 2, 0
>>>>>>> 34, AAC, 4, 0
>>>>>>> 56, BBR, -5, 1
>>>>>>> 78, CCV, -4, 1
>>>>>>> 78, CCV, -12, 1
>>>>>>>
>>>>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>>>>
>>>>>>> Thanks
>>>>>>> Maciek
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>

>>
>>

>



Reply With Quote
  #10 (permalink)  
Old 11-27-2007, 03:56 PM
Rick Rothstein \(MVP - VB\)
 
Posts: n/a
Re: Counting negative values

Well, if you are going to be using F4 while typing the formula in (rather
than going back to use it to edit the ranges afterwards), then there is no
"extra" work involved... simply don't hit F4 for the first cell reference
and do so twice on the second cell reference of each range... same two key
presses of F4 per range, just saved up for use on one instead of both cell
references within it.<vbg>

Rick


"RAGdyer" <RAGdyer@CUTOUTmsn.com> wrote in message
news:eP5UzrPMIHA.5224@TK2MSFTNGP02.phx.gbl...
> Ahhh ... Yes ... BUT ... It's so much more easier to simply hit <F4> once
> in each relevant reference!<bg>
> --
> Regards,
>
> RD
> ----------------------------------------------------------------------------------
> Please keep all correspondence within the Group, so all may benefit !
> ----------------------------------------------------------------------------------
>
> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
> message news:%23TzhdlHMIHA.820@TK2MSFTNGP06.phx.gbl...
>> Yes, you are right... I did forget about that; although the formula would
>> still work as I posted it provided there were no gaps in the data and the
>> data wasn't more than half the number of cells in a column. Of course,
>> the absolute ranges are more practical. I would point out, however, that
>> the columns do not really need to be absolute as the formulas are being
>> copied down (it doesn't hurt to make them absolute, but it isn't
>> mandatory). Also, because the first cell in the range is being compared
>> to itself, the first row of the range does not really need to be absolute
>> either. Had I realized my mistake in leaving out the absolute ranges,
>> this is how I would have posted the formula...
>>
>> =IF(C1="","",--(SUMPRODUCT((C1:C$100<0)*(B1:B$100=B1))>0))
>>
>> But, of course, your posted correction would work fine also.
>>
>> With all that said, thank you for catching my omission and alerting me to
>> it... I really appreciate that.
>>
>> Rick
>>
>>
>> "RAGdyer" <RAGdyer@CUTOUTmsn.com> wrote in message
>> news:%23h7O9CHMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>> Rick really meant to include the absolutes:
>>>
>>> =IF(C1="","",--(SUMPRODUCT(($C$1:$C$100<0)*($B$1:$B$100=B1))>0))
>>> --
>>> Regards,
>>>
>>> RD
>>> ----------------------------------------------------------------------------------
>>> Please keep all correspondence within the Group, so all may benefit !
>>> ----------------------------------------------------------------------------------
>>>
>>>
>>> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
>>> message news:eiMlSjGMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>> Actually, use this equation instead (it suppresses the 0 if there is no
>>>> number in column C)...
>>>>
>>>> =IF(C1="","",--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0))
>>>>
>>>> And, of course, you can change the ranges as required by your data (but
>>>> note that you can copy the formula down passed your last piece of data
>>>> to account for future entries).
>>>>
>>>> Rick
>>>>
>>>>
>>>> "Rick Rothstein (MVP - VB)" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in
>>>> message news:O6UkHcGMIHA.4880@TK2MSFTNGP03.phx.gbl...
>>>>> Give this formula a try...
>>>>>
>>>>> =--(SUMPRODUCT((C1:C100<0)*(B1:B100=B1))>0)
>>>>>
>>>>> Rick
>>>>>
>>>>>
>>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>>> news:OH7q2mFMIHA.4228@TK2MSFTNGP02.phx.gbl...
>>>>>> Hi Peo,
>>>>>>
>>>>>> in my example first 3 values concern the same company, and that's the
>>>>>> case. When at least one value "within" the company is negative then I
>>>>>> want all three rows to have 1 in the fourth column.
>>>>>> I hope that will help.
>>>>>>
>>>>>> Thanks
>>>>>> Maciek
>>>>>>
>>>>>> "Peo Sjoblom" <terre08@mvps.org> wrote in message
>>>>>> news:%23gM2ZNFMIHA.4308@TK2MSFTNGP05.phx.gbl...
>>>>>>> If that's the case why do you get 1 for the first 2 values in your
>>>>>>> example?
>>>>>>>
>>>>>>> =-1*(C2<0)
>>>>>>>
>>>>>>> where C2 would be the first Var1
>>>>>>>
>>>>>>> copy down
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>>
>>>>>>> Peo Sjoblom
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Maciej Grzywna" <relever@wp.pl> wrote in message
>>>>>>> news:OqX9T%23EMIHA.1184@TK2MSFTNGP04.phx.gbl...
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I'd be very grateful if someone could help me with this.
>>>>>>>> I have a following table:
>>>>>>>>
>>>>>>>> No, Company,Var1
>>>>>>>> 12, ZXC, 6
>>>>>>>> 12, ZXC, 4
>>>>>>>> 12, ZXC, -3
>>>>>>>> 34, AAC, 2
>>>>>>>> 34, AAC, 4
>>>>>>>> 56, BBR, -5
>>>>>>>> 78, CCV, -4
>>>>>>>> 78, CCV, -12
>>>>>>>>
>>>>>>>> What I need is another column with some variable that would turn
>>>>>>>> e.g. 1 when company has at least one row with negative value of
>>>>>>>> Var1 and 0 if not. In other words, i'd like to get:
>>>>>>>>
>>>>>>>> No, Company,Var1, Var2
>>>>>>>> 12, ZXC, 6, 1
>>>>>>>> 12, ZXC, 4, 1
>>>>>>>> 12, ZXC, -3, 1
>>>>>>>> 34, AAC, 2, 0
>>>>>>>> 34, AAC, 4, 0
>>>>>>>> 56, BBR, -5, 1
>>>>>>>> 78, CCV, -4, 1
>>>>>>>> 78, CCV, -12, 1
>>>>>>>>
>>>>>>>> I have to add that I have about 9000 rows and i'm using excel 2003.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Maciek
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>

>>

>
>


Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:05 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Credit Cards | Dominios | Knitting | Facebook Proxy | Myspace Layouts



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114