#1   Report Post  
Posted to microsoft.public.excel.misc
Ron
 
Posts: n/a
Default Adding in Excel

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Adding in Excel

The easiest method would be

=A1+A3+A5+A7+A9
=A2+A4+A6+A8+A10

You can also use something like

=SUMPRODUCT(MOD(ROW(A1:A10),2),A1:A10)
=SUMPRODUCT(1-MOD(ROW(A1:A10),2,A1:A10)

This way you can just change the range values if you want to expand the
range without specifying the specific cells.

"Ron" wrote:

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Michael
 
Posts: n/a
Default Adding in Excel

Hi Sloth. If it's not too much trouble, would you mind explaining how that
formula works. I'm afraid I'm struggling with the mod and sumproduct
functions. Thanks in advance.
--
Sincerely, Michael Colvin


"Sloth" wrote:

The easiest method would be

=A1+A3+A5+A7+A9
=A2+A4+A6+A8+A10

You can also use something like

=SUMPRODUCT(MOD(ROW(A1:A10),2),A1:A10)
=SUMPRODUCT(1-MOD(ROW(A1:A10),2,A1:A10)

This way you can just change the range values if you want to expand the
range without specifying the specific cells.

"Ron" wrote:

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Adding in Excel

SUMPRODUCT multiplies values from two arrays
MOD take the remainder of the division
ROW give the row of the cell

Broken Down...
ROW(A1:A10) - {1,2,3,4,5,6,7,8,9,10} *NOTE:{} signifies an array
MOD(ROW(A1:A10),2) - {1,0,1,0,1,0,1,0,1,0}
SUMPRODUCT(~~~) - {1,0,1,0,1,0,1,0,1,0}*{A1,A2,A3,A4,A5,A6,A7,A8,A9, A10}
this becomes...
1*A1+0*A2+1*A3+0*A4+...

the second formula uses 1- and becomes
0*A1+1*A2+0*A3+1*A4+...

Hope this helps

"Michael" wrote:

Hi Sloth. If it's not too much trouble, would you mind explaining how that
formula works. I'm afraid I'm struggling with the mod and sumproduct
functions. Thanks in advance.
--
Sincerely, Michael Colvin


"Sloth" wrote:

The easiest method would be

=A1+A3+A5+A7+A9
=A2+A4+A6+A8+A10

You can also use something like

=SUMPRODUCT(MOD(ROW(A1:A10),2),A1:A10)
=SUMPRODUCT(1-MOD(ROW(A1:A10),2,A1:A10)

This way you can just change the range values if you want to expand the
range without specifying the specific cells.

"Ron" wrote:

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.

  #5   Report Post  
Posted to microsoft.public.excel.misc
Michael
 
Posts: n/a
Default Adding in Excel

Thank you very much Sloth. That helps alot. I'm going to have to experiment
with it to fully capture the concept. Thanks again.
--
Sincerely, Michael Colvin


"Sloth" wrote:

SUMPRODUCT multiplies values from two arrays
MOD take the remainder of the division
ROW give the row of the cell

Broken Down...
ROW(A1:A10) - {1,2,3,4,5,6,7,8,9,10} *NOTE:{} signifies an array
MOD(ROW(A1:A10),2) - {1,0,1,0,1,0,1,0,1,0}
SUMPRODUCT(~~~) - {1,0,1,0,1,0,1,0,1,0}*{A1,A2,A3,A4,A5,A6,A7,A8,A9, A10}
this becomes...
1*A1+0*A2+1*A3+0*A4+...

the second formula uses 1- and becomes
0*A1+1*A2+0*A3+1*A4+...

Hope this helps

"Michael" wrote:

Hi Sloth. If it's not too much trouble, would you mind explaining how that
formula works. I'm afraid I'm struggling with the mod and sumproduct
functions. Thanks in advance.
--
Sincerely, Michael Colvin


"Sloth" wrote:

The easiest method would be

=A1+A3+A5+A7+A9
=A2+A4+A6+A8+A10

You can also use something like

=SUMPRODUCT(MOD(ROW(A1:A10),2),A1:A10)
=SUMPRODUCT(1-MOD(ROW(A1:A10),2,A1:A10)

This way you can just change the range values if you want to expand the
range without specifying the specific cells.

"Ron" wrote:

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.



  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Adding in Excel

Another option.

Insert a helper column (say column A).
Put R, OT, R, OT, R, OT, ... down that column.

Then you can use a formula like:

=sumproduct(--(a1:a20="R"),(b1:b20))

Adjust the ranges to match--but you can't use whole columns.

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

What's nice about this formula is that if you insert a row, you don't break the
formula. (When you add those Vacation hours and Sick hours and ....)

Ron wrote:

I have a time sheet. One row has the total number of Regular hours worked in
7 days. The next row has the total number of Overtime hours worked in those 7
days, the next row regular hours, the next overtime hours, and so on for 5
rows down. At the bottom of the sheet I need to add only the Regular hours in
one cell and I need the total Overtime hours in another cell. So I need a
formula that will add every other row, or every other number in the same
column.


--

Dave Peterson
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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Adding footnote to cell in Excel Tom B Excel Discussion (Misc queries) 1 February 17th 06 10:29 PM
adding characters in excel column rita Excel Discussion (Misc queries) 3 February 16th 06 11:30 PM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 12:32 PM
Excel Adding duplicated numbers together JJ Joobler Excel Discussion (Misc queries) 1 January 7th 05 02:24 AM


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