Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rob Gould
 
Posts: n/a
Default Multiply non-contigious arrays

Hi all. Let's say that I have 10 columns and a row for each day of the
month. All odd columns contain a Dollar value and all even columns
contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob

  #2   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you would
need either array or sumproduct formulas.

Jerry

Rob Gould wrote:

Hi all. Let's say that I have 10 columns and a row for each day of the
month. All odd columns contain a Dollar value and all even columns
contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob


  #3   Report Post  
Rob Gould
 
Posts: n/a
Default

Thanks, but it's not that simple. The example I used was to give the
answer 60 - I see now that it appears that the 60 should be part of the
formula - sorry.. In my actual data, I have more than just 4 columns
and I want to be able to add more if need be. Yes, I could just
multiply and add as you have done in the bracketed section of your
formula, but I thought that arrays were meant to do that quicker (or at
least in a shorter formula).


Jerry W. Lewis wrote:
=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you would


need either array or sumproduct formulas.

Jerry

Rob Gould wrote:

Hi all. Let's say that I have 10 columns and a row for each day of

the
month. All odd columns contain a Dollar value and all even columns
contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob


  #4   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

Array formulas can be faster in that they can allow you to avoid
repeating a calculation that is shared by several cells.

Array formulas can also allow you to perform complicated calculations
without using helper cells.

If my previous formula is not what you are looking for, then your
explanation of what you are trying to do is not adequate for me to
understand your intent sufficiently to suggest a formula.

Jerry

Rob Gould wrote:

Thanks, but it's not that simple. The example I used was to give the
answer 60 - I see now that it appears that the 60 should be part of the
formula - sorry.. In my actual data, I have more than just 4 columns
and I want to be able to add more if need be. Yes, I could just
multiply and add as you have done in the bracketed section of your
formula, but I thought that arrays were meant to do that quicker (or at
least in a shorter formula).


Jerry W. Lewis wrote:

=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you would


need either array or sumproduct formulas.

Jerry

Rob Gould wrote:


Hi all. Let's say that I have 10 columns and a row for each day of

the

month. All odd columns contain a Dollar value and all even columns
contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob


  #5   Report Post  
Rob Gould
 
Posts: n/a
Default

Hi Jerry,

Sorry - let me try and explain clearer...

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

This goes on until COL AJ (15 multiplications added together), which is
why I don't really want a formula that just multiplies and adds
i.e.(A1*B1+C1*D1) - although it will work. In other words, is there a
shorter, more clever formula to use that will do the job?

Rob



Jerry W. Lewis wrote:
Array formulas can be faster in that they can allow you to avoid
repeating a calculation that is shared by several cells.

Array formulas can also allow you to perform complicated calculations


without using helper cells.

If my previous formula is not what you are looking for, then your
explanation of what you are trying to do is not adequate for me to
understand your intent sufficiently to suggest a formula.

Jerry

Rob Gould wrote:

Thanks, but it's not that simple. The example I used was to give

the
answer 60 - I see now that it appears that the 60 should be part of

the
formula - sorry.. In my actual data, I have more than just 4

columns
and I want to be able to add more if need be. Yes, I could just
multiply and add as you have done in the bracketed section of your
formula, but I thought that arrays were meant to do that quicker

(or at
least in a shorter formula).


Jerry W. Lewis wrote:

=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you

would


need either array or sumproduct formulas.

Jerry

Rob Gould wrote:


Hi all. Let's say that I have 10 columns and a row for each day

of

the

month. All odd columns contain a Dollar value and all even

columns
contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob




  #6   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

Much clearer, although I make that 18 multiplications instead of 15.

Try
=SUM(IF(MOD(COLUMN(B1:AJ1),2)=0,B1:AJ1,0)*IF(MOD(C OLUMN(A1:AI1),2)=1,A1:AI1,0))
array entered (Ctrl-Shift-Enter, or Apple-enter if you have a Mac). If
you do it properly, the formula bar will then display
{=SUM(IF(MOD(COLUMN(B1:AJ1),2)=0,B1:AJ1,0)*IF(MOD( COLUMN(A1:AI1),2)=1,A1:AI1,0))}
even though you did not type the surrounding curly brackets. Note that
cell ranges are not identical in the two embedded IF()s; that is to the
values aligned that you want to multiply.

This would be much easier if you set it up as
A1 = $2
A2 = 5
B1 = $5
B2 = 10
....
In that case, you could simply use
=SUMPRODUCT(A1:R1,A2:R2)


OPEN QUESTION:

=SUM(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0)*IF(MOD(COL UMN(A1:C1),2)=1,A1:C1,0))

returns 60, as expected, but

=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0)*IF( MOD(COLUMN(A1:C1),2)=1,A1:C1,0))
=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0),IF( MOD(COLUMN(A1:C1),2)=1,A1:C1,0))
=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1),IF(MO D(COLUMN(A1:C1),2)=1,A1:C1))

all return 85 instead of the expected 60 (Excel 2002 SP-2).
Does anybody know why?

Jerry

Rob Gould wrote:

Hi Jerry,

Sorry - let me try and explain clearer...

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

This goes on until COL AJ (15 multiplications added together), which is
why I don't really want a formula that just multiplies and adds
i.e.(A1*B1+C1*D1) - although it will work. In other words, is there a
shorter, more clever formula to use that will do the job?

Rob



Jerry W. Lewis wrote:

Array formulas can be faster in that they can allow you to avoid
repeating a calculation that is shared by several cells.

Array formulas can also allow you to perform complicated calculations


without using helper cells.

If my previous formula is not what you are looking for, then your
explanation of what you are trying to do is not adequate for me to
understand your intent sufficiently to suggest a formula.

Jerry

Rob Gould wrote:


Thanks, but it's not that simple. The example I used was to give

the

answer 60 - I see now that it appears that the 60 should be part of

the

formula - sorry.. In my actual data, I have more than just 4

columns

and I want to be able to add more if need be. Yes, I could just
multiply and add as you have done in the bracketed section of your
formula, but I thought that arrays were meant to do that quicker

(or at

least in a shorter formula).


Jerry W. Lewis wrote:


=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you

would

need either array or sumproduct formulas.

Jerry

Rob Gould wrote:



Hi all. Let's say that I have 10 columns and a row for each day

of

the


month. All odd columns contain a Dollar value and all even

columns

contain a quantity. How can I multiply each Dollar amount by its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob



  #7   Report Post  
Rob Gould
 
Posts: n/a
Default

That works fine - thanks for all your help and patience Jerry.

Jerry W. Lewis wrote:
Much clearer, although I make that 18 multiplications instead of 15.

Try

=SUM(IF(MOD(COLUMN(B1:AJ1),2)=0,B1:AJ1,0)*IF(MOD(C OLUMN(A1:AI1),2)=1,A1:AI1,0))
array entered (Ctrl-Shift-Enter, or Apple-enter if you have a Mac).

If
you do it properly, the formula bar will then display

{=SUM(IF(MOD(COLUMN(B1:AJ1),2)=0,B1:AJ1,0)*IF(MOD( COLUMN(A1:AI1),2)=1,A1:AI1,0))}
even though you did not type the surrounding curly brackets. Note

that
cell ranges are not identical in the two embedded IF()s; that is to

the
values aligned that you want to multiply.

This would be much easier if you set it up as
A1 = $2
A2 = 5
B1 = $5
B2 = 10
...
In that case, you could simply use
=SUMPRODUCT(A1:R1,A2:R2)


OPEN QUESTION:


=SUM(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0)*IF(MOD(COL UMN(A1:C1),2)=1,A1:C1,0))

returns 60, as expected, but


=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0)*IF( MOD(COLUMN(A1:C1),2)=1,A1:C1,0))

=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1,0),IF( MOD(COLUMN(A1:C1),2)=1,A1:C1,0))

=SUMPRODUCT(IF(MOD(COLUMN(B1:D1),2)=0,B1:D1),IF(MO D(COLUMN(A1:C1),2)=1,A1:C1))

all return 85 instead of the expected 60 (Excel 2002 SP-2).
Does anybody know why?

Jerry

Rob Gould wrote:

Hi Jerry,

Sorry - let me try and explain clearer...

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

This goes on until COL AJ (15 multiplications added together),

which is
why I don't really want a formula that just multiplies and adds
i.e.(A1*B1+C1*D1) - although it will work. In other words, is

there a
shorter, more clever formula to use that will do the job?

Rob



Jerry W. Lewis wrote:

Array formulas can be faster in that they can allow you to avoid
repeating a calculation that is shared by several cells.

Array formulas can also allow you to perform complicated

calculations


without using helper cells.

If my previous formula is not what you are looking for, then your
explanation of what you are trying to do is not adequate for me to
understand your intent sufficiently to suggest a formula.

Jerry

Rob Gould wrote:


Thanks, but it's not that simple. The example I used was to give

the

answer 60 - I see now that it appears that the 60 should be part

of

the

formula - sorry.. In my actual data, I have more than just 4

columns

and I want to be able to add more if need be. Yes, I could just
multiply and add as you have done in the bracketed section of your
formula, but I thought that arrays were meant to do that quicker

(or at

least in a shorter formula).


Jerry W. Lewis wrote:


=60-(A1*B1+C1*D1)

If you are putting these formulas in E, it is not clear why you

would

need either array or sumproduct formulas.

Jerry

Rob Gould wrote:



Hi all. Let's say that I have 10 columns and a row for each day

of

the


month. All odd columns contain a Dollar value and all even

columns

contain a quantity. How can I multiply each Dollar amount by

its
quantity and sum these for each day? An Array or sumproduct?

Example:
A1 = $2
B1 = 5
C1 = $5
D1 = 10

Answer in E1 must be 60 - (2*5 + 5*10)

Thanks.

Rob



  #8   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

You're welcome. Glad it helped.

Jerry

Rob Gould wrote:

That works fine - thanks for all your help and patience Jerry.


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
Formula Arrays VERY SLOW in Excel 2002 Patrick Excel Worksheet Functions 2 January 27th 05 12:59 AM
how do i multiply hours:minutes by a cash value? Jeremy Flisher Excel Worksheet Functions 1 January 17th 05 03:52 PM
Employing constant arrays to limit nested IF statements. Richard-44 Excel Worksheet Functions 2 January 6th 05 02:19 AM
Comparing Arrays KL Excel Worksheet Functions 9 December 3rd 04 08:58 PM
multiply by actual number in cell CJ Cerezo Excel Worksheet Functions 3 November 29th 04 09:43 PM


All times are GMT +1. The time now is 07:06 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"