Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default How to calculate: sumproduct / db??

In a database I have:

column A: name of fruit
column B: number of boxes
column C: price of one box
column D: number of pieces fruit in a box
column E: price per piece of the fruit

I would like to know how to calculate the total value of one sort of fruit.
So, the result must be for "apple" the sum of (columnB * columnC)+(columnD *
columnE). Should I use the db-functions / sumproduct? Any help / suggestion
would be highly appriciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default How to calculate: sumproduct / db??

Gert-Jan wrote:
In a database I have:

column A: name of fruit
column B: number of boxes
column C: price of one box
column D: number of pieces fruit in a box
column E: price per piece of the fruit

I would like to know how to calculate the total value of one sort of
fruit. So, the result must be for "apple" the sum of (columnB *
columnC)+(columnD * columnE). Should I use the db-functions /
sumproduct? Any help / suggestion would be highly appriciated.



Hi Gert-Jan,

If, as it should be, price of one box (column C) = number of pieces fruit in
a box (column D) * price per piece of the fruit (column E), you can use one
of these SUMPRODUCT formulas:

=SUMPRODUCT(($A$2:$A$20=$G$1)*($B$2:$B$20)*($D$2:$ D$20)*($E$2:$E$20))

or

=SUMPRODUCT(($A$2:$A$20=$G$1)*($B$2:$B$20)*($C$2:$ C$20))


Where in G1 you can type (or maybe you can use Validation Data...) the name
of the fruit.

You have to adjust the references of ranges as for your conveniences, but be
aware that you can't use the whole column as argument for SUMPRODUCT.


--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to calculate: sumproduct / db??

I don't understand why you multiply the number of boxes by the price per box
and the number of pieces per box * price per piece, but this does it

=SUMPRODUCT(--(A2:A200="Apple"),(B2:B200*C2:C200)+(D2:D200*E2:E2 00))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In a database I have:

column A: name of fruit
column B: number of boxes
column C: price of one box
column D: number of pieces fruit in a box
column E: price per piece of the fruit

I would like to know how to calculate the total value of one sort of

fruit.
So, the result must be for "apple" the sum of (columnB * columnC)+(columnD

*
columnE). Should I use the db-functions / sumproduct? Any help /

suggestion
would be highly appriciated.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default How to calculate: sumproduct / db??

Hi Bob, this works great, thanks a lot!

I have done a lot with formulas, but I have never seen that -- in a formula
before. Removing one makes the ammount negative, removing them both makes
the result zero.

Can you shortly explain how this works and when to use it?

Gert-Jan

"Bob Phillips" schreef in bericht
...
I don't understand why you multiply the number of boxes by the price per
box
and the number of pieces per box * price per piece, but this does it

=SUMPRODUCT(--(A2:A200="Apple"),(B2:B200*C2:C200)+(D2:D200*E2:E2 00))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In a database I have:

column A: name of fruit
column B: number of boxes
column C: price of one box
column D: number of pieces fruit in a box
column E: price per piece of the fruit

I would like to know how to calculate the total value of one sort of

fruit.
So, the result must be for "apple" the sum of (columnB *
columnC)+(columnD

*
columnE). Should I use the db-functions / sumproduct? Any help /

suggestion
would be highly appriciated.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default How to calculate: sumproduct / db??

Gert-Jan wrote:
Hi Bob, this works great, thanks a lot!

I have done a lot with formulas, but I have never seen that -- in a
formula before. Removing one makes the ammount negative, removing
them both makes the result zero.


You can see a very good explanation at Debra Dalgleish's site:

http://www.xldynamic.com/source/xld.SUMPRODUCT.html


--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to calculate: sumproduct / db??

Hi Gert-Jan,

simply put, the test

(A2:A200="Apple")

returns an array of TRUE/FALSE values. Performing an arithmetic operation on
it transforms this to an array of 1/0 values, which SP can use to multiply
by the actual values to get only the values where a condition is met. So a
single unary, -, transforms the TRUE/FALSE to 1/0, but a negative 1. So a
second is required to get it back to positive 1.

Thee is a lot more detail at

http://www.xldynamic.com/source/xld.SUMPRODUCT.html .

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
Hi Bob, this works great, thanks a lot!

I have done a lot with formulas, but I have never seen that -- in a

formula
before. Removing one makes the ammount negative, removing them both makes
the result zero.

Can you shortly explain how this works and when to use it?

Gert-Jan

"Bob Phillips" schreef in bericht
...
I don't understand why you multiply the number of boxes by the price per
box
and the number of pieces per box * price per piece, but this does it

=SUMPRODUCT(--(A2:A200="Apple"),(B2:B200*C2:C200)+(D2:D200*E2:E2 00))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In a database I have:

column A: name of fruit
column B: number of boxes
column C: price of one box
column D: number of pieces fruit in a box
column E: price per piece of the fruit

I would like to know how to calculate the total value of one sort of

fruit.
So, the result must be for "apple" the sum of (columnB *
columnC)+(columnD

*
columnE). Should I use the db-functions / sumproduct? Any help /

suggestion
would be highly appriciated.








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to calculate: sumproduct / db??

Sorry, but I have to correct you on this Franz, that is the second time <g.
That is not Debra's site, Debra maintains the excellent
http://www.contextures.com

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Franz Verga" wrote in message
...
Gert-Jan wrote:
Hi Bob, this works great, thanks a lot!

I have done a lot with formulas, but I have never seen that -- in a
formula before. Removing one makes the ammount negative, removing
them both makes the result zero.


You can see a very good explanation at Debra Dalgleish's site:

http://www.xldynamic.com/source/xld.SUMPRODUCT.html


--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default How to calculate: sumproduct / db??

Bob Phillips wrote:
Sorry, but I have to correct you on this Franz, that is the second
time <g. That is not Debra's site, Debra maintains the excellent
http://www.contextures.com


Sorry Bob, I apologize to you (also for my bad English), but I was really
sure I had taken that link from Debra's site... :-(

Anyway that page is very interesting and useful to understand SUMPRODUCT
function and its possible uses...

Sorry again...


--
Thanks in advance for your feedback.

Ciao

Franz Verga from Italy


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to calculate: sumproduct / db??

What have you got to be sorry about, your team made the World Cup Final, and
were brilliant to boot.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Franz Verga" wrote in message
...

Sorry Bob, I apologize to you (also for my bad English), but I was really
sure I had taken that link from Debra's site... :-(

Anyway that page is very interesting and useful to understand SUMPRODUCT
function and its possible uses...

Sorry again...


--
Thanks in advance for your feedback.

Ciao

Franz Verga from Italy




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
Sumproduct with Condition OR Sumproduct with ADDRESS function - HE gholly Excel Discussion (Misc queries) 2 September 28th 09 05:07 PM
sumproduct calculation does not calculate entire range John Gregory Excel Discussion (Misc queries) 5 September 11th 09 09:16 PM
SUMPRODUCT to calculate unique occurences of string in column of d WildWill Excel Discussion (Misc queries) 3 April 3rd 09 03:16 PM
Using SumProduct and Count To Calculate % Ranks SteveC Excel Worksheet Functions 4 April 28th 06 02:12 PM
SUMPRODUCT TO CALCULATE VISIBLE CELLS ONLY Lisa Excel Worksheet Functions 4 January 11th 05 12:58 PM


All times are GMT +1. The time now is 08:29 AM.

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"