adding the product of various pairs of cells...

racingsnake2000

New Member
Joined
Aug 11, 2011
Messages
32
Hello Again...
After being helped so quickly with my last question, I thought I'd post again!
This time, I'd like to multiply adjacent cells in a row in pairs only and then add the solutions of each pair to achieve a total.
The problem I have is this:
Some of the pairs have no values in them, and the others do....
What happens in the answer column is that I end up getting the #VALUE! answer.
How do I get my formula to ignore the pairs(or individual cells) with no values in them to achieve the answer?
In each row, there are 26 pairs of cells that need to be multiplied and the 26 solutions need to be added together. There are however only a random single pair of cells with values in them in each of the 6848 rows...
Thanks again for your time!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Don't laugh!

=SUM(AS4*AT4)+SUM(AU4*AV4)+SUM(AW4*AX4)+SUM(AY4*AZ4)+SUM(BA4*BB4)+SUM(BC4*BD4)+SUM(BE4*BF4)+SUM(BG4*BH4)+SUM(BI4*BJ4)+SUM(BK4*BL4)+SUM(BM4*BN4)+SUM(BO4*BP4)+SUM(BQ4*BR4)+SUM(BS4*BT4)+SUM(BU4*BV4)+SUM(BW4*BX4)+SUM(BY4*BZ4)+SUM(CA4*CB4)+SUM(CC4*CD4)+SUM(CE4*CF4)+SUM(CG4*CH4)+SUM(CI4*CJ4)+SUM(CK4*CL4)+SUM(CM4*CN4)+SUM(CO4*CP4)+SUM(CQ4*CR4)

I'm self taught and nearly failed maths in school, so it takes a little while to pick things up:)
 
Upvote 0
Hello Again...
After being helped so quickly with my last question, I thought I'd post again!
This time, I'd like to multiply adjacent cells in a row in pairs only and then add the solutions of each pair to achieve a total.
The problem I have is this:
Some of the pairs have no values in them, and the others do....
What happens in the answer column is that I end up getting the #VALUE! answer.
How do I get my formula to ignore the pairs(or individual cells) with no values in them to achieve the answer?
In each row, there are 26 pairs of cells that need to be multiplied and the 26 solutions need to be added together. There are however only a random single pair of cells with values in them in each of the 6848 rows...
Thanks again for your time!
Is this what you want:

Book1
AB
235
32_
4_6
5102
6__
7__
8103
952
1027
Sheet1

=SUMPRODUCT(A2:A10,B2:B10)

Returns 89

Empty cells are evaluated as 0 and 0*N = 0 and SUM of 0 has no effect on the final total.
 
Upvote 0
Not really...
I have 52 cells adjacent to each other in say row 5.
I' like to multiply for example A5*B5+C5*D5+E5*F5+G5*H5 etc...
All up there are 26 pairs of cells that need to be multiplied as pairs and then the solutions to each of those 26 equations need to be added together to provide an answer to the horizontal row.

Does that make sense?
 
Upvote 0
I couldn't get the #value with empty cells with your formula (in AQ4 below) except by putting some text in a cell (see below). However the formula in AP4 (which must be entered using CTRL+SHIFT+ENTER - not just with ENTER) seems to be immune from text and blanks.
I haven't shown the whole range, but it goes up by 1 until column CR.
It gives the same answers as your formula.

Excel Workbook
APAQARASATAUAVAWAXAY
424090#VALUE!12aa4567
Sheet12
 
Upvote 0
Not really...
I have 52 cells adjacent to each other in say row 5.
I' like to multiply for example A5*B5+C5*D5+E5*F5+G5*H5 etc...
All up there are 26 pairs of cells that need to be multiplied as pairs and then the solutions to each of those 26 equations need to be added together to provide an answer to the horizontal row.

Does that make sense?
Try this array formula**:

=SUMPRODUCT(IF(MOD(COLUMN(A5:G5)-COLUMN(A5),2)=0,A5:G5),IF(MOD(COLUMN(B5:H5)-COLUMN(A5),2)=1,B5:H5))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Note how the ranges are offset.

Also, this formula is robust against new column insertions to the left of the referenced range. If you know for certain that you will never need to insert new columns to the left of the referenced range then we can use this slightly shorter less complicated version.

Still array entered**:

=SUMPRODUCT(IF(MOD(COLUMN(A5:G5),2)=1,A5:G5),IF(MOD(COLUMN(B5:H5),2)=0,B5:H5))
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top