Tricky array problem….

  • Thread starter Thread starter MarkCCB
  • Start date Start date
M

MarkCCB

I have a (small) problem which I am unable to solve. Perhaps some brigh
wizard has an idea.

I would like to multiply two arrays located in equal sized rows bu
invert one first, i.e. if the values are: A, B, C and X, Y, Z, I wan
AZ+BY+CX.

e.g. if the ranges are 1,2,3 and 1,2,3, my answer should be 10.

My ranges are dynamic so could become much larger than 3 elements.

I tried to invert one of the arrays using the array formula:

=OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult)))

where Mult is the array field (am quite proud of this!!!). If I use F9
this formula does invert the array. However, as soon as I try to us
this in a larger formula to complete the multiplication, I get #Value
:

=SUM(OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult)))*CinList)

where CinList is the other array.

Any ideas much appreciated...
 
MarkCCB said:
I have a (small) problem which I am unable to solve. Perhaps some bright
wizard has an idea.

I would like to multiply two arrays located in equal sized rows but
invert one first, i.e. if the values are: A, B, C and X, Y, Z, I want
AZ+BY+CX.

e.g. if the ranges are 1,2,3 and 1,2,3, my answer should be 10.

My ranges are dynamic so could become much larger than 3 elements.

I tried to invert one of the arrays using the array formula:

=OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult)))

where Mult is the array field (am quite proud of this!!!). If I use F9,
this formula does invert the array. However, as soon as I try to use
this in a larger formula to complete the multiplication, I get #Value!
:

=SUM(OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult)))*CinList)

where CinList is the other array.

Any ideas much appreciated....


Hi Mark

=SUM(N(OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult))))*CinList)

Will do the trick.

Using the function N() with OFFSET() sometimes works, sometimes doesn't.
(One of the charms one enjoys working with array formulae :-)

In this situation you can skip <Shift><Ctrl><Enter> and just use <Enter>
by using SUMPRODUCT()

=SUMPRODUCT(N(OFFSET(Mult,0,COLUMNS(Mult)-1+(MIN(COLUMN(Mult))-COLUMN(Mult))))*CinList)
 
Leo,
awesome, you are truly a wizard ! It works ! Thankyou so much ! I spen
half a day messing about with this.......
Best regard
 
MarkCCB said:
Leo,
awesome, you are truly a wizard ! It works ! Thankyou so much ! I spent
half a day messing about with this.......
Best regards

You're welcome, Mark, and thanks for the feedback :-)

Leo Heuser
 
Back
Top