Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RF RF is offline
external usenet poster
 
Posts: 9
Default Multiplying non consecutive rows, then adding it.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Multiplying non consecutive rows, then adding it.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Multiplying non consecutive rows, then adding it.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Multiplying non consecutive rows, then adding it.

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Multiplying non consecutive rows, then adding it.

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
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
Multiplying then adding Two Rows of Numbers BRob Excel Worksheet Functions 3 May 28th 08 01:52 PM
Consecutive No'ing WHEN ADDING/DELETING ROWS CMack Excel Discussion (Misc queries) 2 January 17th 08 03:08 PM
Multiplying non consecutive rows, than adding it. RF Excel Discussion (Misc queries) 13 July 6th 07 02:32 PM
Multiplying non consecutive rows, then adding it. RF Excel Worksheet Functions 8 July 4th 07 10:46 PM
Adding + Multiplying 2 Colums' Rows ruscak Excel Programming 1 August 22nd 05 06:32 PM


All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"