Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
CMAC
 
Posts: n/a
Default sum product in an index possibly?

trying to do a formula along the lines of: search column b for "n", if its an
"n" then multilply column d by column c. I need it to include all occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUMPRODUCT(--(B1:B100="n"),C1:C100,D1:D100)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"CMAC" wrote in message
...
trying to do a formula along the lines of: search column b for "n", if its

an
"n" then multilply column d by column c. I need it to include all

occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1



  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))


Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for "n", if its an
"n" then multilply column d by column c. I need it to include all occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1

  #4   Report Post  
Tim C
 
Posts: n/a
Default

Just curious. Why would you use

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

instead of

=SUMPRODUCT((B2:B8="n")*(C2:C8*D2:D8))

Is there a speed issue? Or am I missing something else?

Thanks,
Tim C

"Peo Sjoblom" wrote in message
...
One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))


Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for "n", if
its an
"n" then multilply column d by column c. I need it to include all
occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1



  #5   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

I wasn't consistent, Bob's formula was

http://www.mcgimpsey.com/excel/formulae/doubleneg.html



--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)



"Tim C" wrote in message
...
Just curious. Why would you use

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

instead of

=SUMPRODUCT((B2:B8="n")*(C2:C8*D2:D8))

Is there a speed issue? Or am I missing something else?

Thanks,
Tim C

"Peo Sjoblom" wrote in message
...
One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))


Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for "n", if
its an
"n" then multilply column d by column c. I need it to include all
occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1







  #6   Report Post  
Tim C
 
Posts: n/a
Default

I multiply the terms "manually" instead of separating them with a comma,
thereby forcing the conversion without the double negative. I end up with a
single term, with SUMPRODUCT taking care of the adding and the array
handling. To me this results in a cleaner, more easily understood formula.

Is this just a personal preference or are there advantages to doing it Bob's
way?

(My formula would be more concise if I took out the last set of parenthesis,
but I think the intent of the formula is more easily understood with them in
place. This can be very helpful for later troubleshooting or modification.)

Tim C

"Peo Sjoblom" wrote in message
...
I wasn't consistent, Bob's formula was

http://www.mcgimpsey.com/excel/formulae/doubleneg.html

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)

"Tim C" wrote in message
...
Just curious. Why would you use

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

instead of

=SUMPRODUCT((B2:B8="n")*(C2:C8*D2:D8))

Is there a speed issue? Or am I missing something else?

Thanks,
Tim C

"Peo Sjoblom" wrote in message
...
One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for "n", if
its an
"n" then multilply column d by column c. I need it to include all
occurances
though. so in the exapmle below it would include eeee, hhhh, and kkkk.
does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1



  #7   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
Advantages of using the double minus:
- slightly faster (approx. 5%)
- no problems if you have text values in your range (e.g. a heading row).
The multiplication syntax will fail the double minus not (will ignore text
cells)

But take a look at:
http://www.xldynamic.com/source/xld....CT.html#format

--
Regards
Frank Kabel
Frankfurt, Germany

Tim C wrote:
I multiply the terms "manually" instead of separating them with a
comma, thereby forcing the conversion without the double negative. I
end up with a single term, with SUMPRODUCT taking care of the adding
and the array handling. To me this results in a cleaner, more easily
understood formula.
Is this just a personal preference or are there advantages to doing
it Bob's way?

(My formula would be more concise if I took out the last set of
parenthesis, but I think the intent of the formula is more easily
understood with them in place. This can be very helpful for later
troubleshooting or modification.)
Tim C

"Peo Sjoblom" wrote in message
...
I wasn't consistent, Bob's formula was

http://www.mcgimpsey.com/excel/formulae/doubleneg.html

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)

"Tim C" wrote in message
...
Just curious. Why would you use

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

instead of

=SUMPRODUCT((B2:B8="n")*(C2:C8*D2:D8))

Is there a speed issue? Or am I missing something else?

Thanks,
Tim C

"Peo Sjoblom" wrote in
message ...
One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for
"n", if its an
"n" then multilply column d by column c. I need it to include all
occurances
though. so in the exapmle below it would include eeee, hhhh, and
kkkk. does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1



  #8   Report Post  
Tim C
 
Posts: n/a
Default

Frank,

Danke.

Tim C

"Frank Kabel" wrote in message
...
Hi
Advantages of using the double minus:
- slightly faster (approx. 5%)
- no problems if you have text values in your range (e.g. a heading row).
The multiplication syntax will fail the double minus not (will ignore text
cells)

But take a look at:
http://www.xldynamic.com/source/xld....CT.html#format

--
Regards
Frank Kabel
Frankfurt, Germany

Tim C wrote:
I multiply the terms "manually" instead of separating them with a
comma, thereby forcing the conversion without the double negative. I
end up with a single term, with SUMPRODUCT taking care of the adding
and the array handling. To me this results in a cleaner, more easily
understood formula.
Is this just a personal preference or are there advantages to doing
it Bob's way?

(My formula would be more concise if I took out the last set of
parenthesis, but I think the intent of the formula is more easily
understood with them in place. This can be very helpful for later
troubleshooting or modification.)
Tim C

"Peo Sjoblom" wrote in message
...
I wasn't consistent, Bob's formula was

http://www.mcgimpsey.com/excel/formulae/doubleneg.html

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)

"Tim C" wrote in message
...
Just curious. Why would you use

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

instead of

=SUMPRODUCT((B2:B8="n")*(C2:C8*D2:D8))

Is there a speed issue? Or am I missing something else?

Thanks,
Tim C

"Peo Sjoblom" wrote in
message ...
One way

=SUMPRODUCT(--(B2:B8="n"),(C2:C8*D2:D8))

Regards

Peo Sjoblom


"CMAC" wrote:

trying to do a formula along the lines of: search column b for
"n", if its an
"n" then multilply column d by column c. I need it to include all
occurances
though. so in the exapmle below it would include eeee, hhhh, and
kkkk. does anyone know what a proper formula would be?
many thanks.

A b c d
eeee n 60 1
ffff y 55 2
gggg j 12 1
hhhh n 50 2
iiii j 14 3
jjjj y 14 1
kkkk n 50 1





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i turn the help index on again? yukk Excel Discussion (Misc queries) 1 January 21st 05 11:07 PM
Vlookup, Index & Match Phyllis Excel Worksheet Functions 1 November 8th 04 06:11 PM
If statement needed Patsy Excel Worksheet Functions 1 November 4th 04 03:48 PM
index match and sum Pamela Excel Worksheet Functions 4 October 27th 04 08:10 PM
index to a range of cells Frank Kabel Excel Worksheet Functions 0 October 27th 04 05:39 PM


All times are GMT +1. The time now is 12:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"