Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I need your help here. I am trying to calculate a monthly progress of planned vs. real. My "planned" formula is ok. The problem comes for the "real" one. Let's say I wanted to multiply the odd rows from D2:D63 * even rows from B2:B63, then add the results. I have tried things like =SUMPRODUCT((IF(MOD(ROW(D2:D63),2)=1,D2:D63,0)*IF( MOD(ROW(B2:B63),2)=0,B2:B63,0))) but it won't work, it will always display 0 as a result. Odd rows from B2:B63 will be blank, and in D2:D63 we will have the "real" progress on odd rows and "planned" progress on even rows. I know it shouldn't be so difficult, but I'm stuck. Thanks in advance. Regards, RF |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The problem you're running into is in one group, you are looking at only even
rows and the other group looks at odd rows and when you multiply the result, you'll always get 0. Try this: Sum of Even Rows =SUMPRODUCT(--(MOD(ROW($D$2:$D$63),2)=0),($D$2:$D$63)) Sum of Odd Rows =SUMPRODUCT(--(MOD(ROW($D$2:$D$63),2)=1),($D$2:$D$63)) HTH, Barb Reinhardt "RF" wrote: Hello, I need your help here. I am trying to calculate a monthly progress of planned vs. real. My "planned" formula is ok. The problem comes for the "real" one. Let's say I wanted to multiply the odd rows from D2:D63 * even rows from B2:B63, then add the results. I have tried things like =SUMPRODUCT((IF(MOD(ROW(D2:D63),2)=1,D2:D63,0)*IF( MOD(ROW(B2:B63),2)=0,B2:B63,0))) but it won't work, it will always display 0 as a result. Odd rows from B2:B63 will be blank, and in D2:D63 we will have the "real" progress on odd rows and "planned" progress on even rows. I know it shouldn't be so difficult, but I'm stuck. Thanks in advance. Regards, RF |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have to line up the rows in your formula. This multiplies 1 * 2 + 3 * 4
=SUMPRODUCT((IF(MOD(ROW(D1:D63),2)=1,D1:D63,0)*IF( MOD(ROW(B2:B64),2)=0,B2:B64,0))) Adjust the ranges so the proper rows are multiplied. =SUMPRODUCT((IF(MOD(ROW(D3:D63),2)=1,D3:D63,0)*IF( MOD(ROW(B2:B62),2)=0,B2:B62,0))) for example ( 2 * 3 + 4 * 5 + etc) -- Regards, Tom Ogilvy "RF" wrote: Hello, I need your help here. I am trying to calculate a monthly progress of planned vs. real. My "planned" formula is ok. The problem comes for the "real" one. Let's say I wanted to multiply the odd rows from D2:D63 * even rows from B2:B63, then add the results. I have tried things like =SUMPRODUCT((IF(MOD(ROW(D2:D63),2)=1,D2:D63,0)*IF( MOD(ROW(B2:B63),2)=0,B2:B63,0))) but it won't work, it will always display 0 as a result. Odd rows from B2:B63 will be blank, and in D2:D63 we will have the "real" progress on odd rows and "planned" progress on even rows. I know it shouldn't be so difficult, but I'm stuck. Thanks in advance. Regards, RF |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here too?!!?
Hmm! I have been answering your question over in m.p.e.misc group while you are running it here and m.p.e.worksheet.functions too. Something for you to consider for the future... From a post by Jeff Johnson: "You have posted this question individually to multiple groups. This is called Multiposting and it's BAD. Replies made in one group will not be visible in the other groups, which may cause multiple people to respond to your question with the same answer because they didn't know someone else had already done it. This is a waste of time. If you MUST post your message to multiple groups, post a single message and select all the groups (or type their names manually in the Newsgroups field, separated by commas) in which you want it to be seen. This is called Crossposting and when used properly it is GOOD." Some additional comment previously posted by me: "You may not see this as a problem, but those of us who volunteer answering questions on newsgroups do see it as a problem. You can't imagine how annoying it is for a volunteer to read a question, research background material, test sample code and then formulate and post an answer to the original question only to go to another newsgroup and find the question posted and ALREADY answered over there. On top of that, if you cross-post your question, all of the readers in all the newsgroups it is cross-posted to get to see both the original question and all of the answers given to it. This is beneficial to you because then we can add additional material to, add clarification to, as well as add additional examples to an answer you have received previously... that means you end up with a more complete solution to your problem. This is a win-win situation for all of us." Rick "RF" wrote in message ... Hello, I need your help here. I am trying to calculate a monthly progress of planned vs. real. My "planned" formula is ok. The problem comes for the "real" one. Let's say I wanted to multiply the odd rows from D2:D63 * even rows from B2:B63, then add the results. I have tried things like =SUMPRODUCT((IF(MOD(ROW(D2:D63),2)=1,D2:D63,0)*IF( MOD(ROW(B2:B63),2)=0,B2:B63,0))) but it won't work, it will always display 0 as a result. Odd rows from B2:B63 will be blank, and in D2:D63 we will have the "real" progress on odd rows and "planned" progress on even rows. I know it shouldn't be so difficult, but I'm stuck. Thanks in advance. Regards, RF |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure what was posted in the other group, but since you have blanks
in one range, can't you just adjust the ranges in the formula to leave out the top (bottom) cell, respectively? Then the desired factors are aligned, and the blanks cancel the unwanted data. = sumproduct(D3:D63*B2:b62) works for me. On Jul 4, 3:28 pm, RF wrote: Hello, I need your help here. I am trying to calculate a monthly progress of planned vs. real. My "planned" formula is ok. The problem comes for the "real" one. Let's say I wanted to multiply the odd rows from D2:D63 * even rows from B2:B63, then add the results. I have tried things like =SUMPRODUCT((IF(MOD(ROW(D2:D63),2)=1,D2:D63,0)*IF( MOD(ROW(B2:B63),2)=0,B2:B63,0))) but it won't work, it will always display 0 as a result. Odd rows from B2:B63 will be blank, and in D2:D63 we will have the "real" progress on odd rows and "planned" progress on even rows. I know it shouldn't be so difficult, but I'm stuck. Thanks in advance. Regards, RF |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiplying then adding Two Rows of Numbers | Excel Worksheet Functions | |||
Consecutive No'ing WHEN ADDING/DELETING ROWS | Excel Discussion (Misc queries) | |||
Multiplying non consecutive rows, than adding it. | Excel Discussion (Misc queries) | |||
Multiplying non consecutive rows, then adding it. | Excel Worksheet Functions | |||
Adding + Multiplying 2 Colums' Rows | Excel Programming |