PC Review


Reply
Thread Tools Rate Thread

2 sheets and code

 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      6th Sep 2007
hey all,
let's say i have a list of employee id's on sheet1. And on sheet 2 there's a
list of employee records vacation hours taken (1-to-many). what is the best
way to iterate thru sheet1 and sum up all the hours for each employee in
sheet2 and place the total in a new column in sheet1 next to respective
employee?


sheet1
id,name,total hours
1,john doe,16

sheet2
id,hours,date
1,4,5/6/07
1,4,12/1/06
1,8,3/12/06

thanks,
rodchar
 
Reply With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      6th Sep 2007
SumIf. Example below is assuming that the employee ID is in column A
of both sheets and that the hours taken is in column B of sheet2. It
is also assuming that we are dealing with the record in A2 of sheet1.
=SUMIF(Sheet2!A:A,Sheet1!A2,Sheet2!B:B)
rodchar wrote:
> hey all,
> let's say i have a list of employee id's on sheet1. And on sheet 2 there's a
> list of employee records vacation hours taken (1-to-many). what is the best
> way to iterate thru sheet1 and sum up all the hours for each employee in
> sheet2 and place the total in a new column in sheet1 next to respective
> employee?
>
>
> sheet1
> id,name,total hours
> 1,john doe,16
>
> sheet2
> id,hours,date
> 1,4,5/6/07
> 1,4,12/1/06
> 1,8,3/12/06
>
> thanks,
> rodchar


 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      6th Sep 2007
Say Sheet2 goes on for 100 rows. Then in C1 of Sheet1 enter:

=SUMPRODUCT(--(Sheet2!A$1:A$100=A1),(Sheet2!B$1:B$100))
and copy down
--
Gary''s Student - gsnu200743


"rodchar" wrote:

> hey all,
> let's say i have a list of employee id's on sheet1. And on sheet 2 there's a
> list of employee records vacation hours taken (1-to-many). what is the best
> way to iterate thru sheet1 and sum up all the hours for each employee in
> sheet2 and place the total in a new column in sheet1 next to respective
> employee?
>
>
> sheet1
> id,name,total hours
> 1,john doe,16
>
> sheet2
> id,hours,date
> 1,4,5/6/07
> 1,4,12/1/06
> 1,8,3/12/06
>
> thanks,
> rodchar

 
Reply With Quote
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      7th Sep 2007
Thanks all for the great insight,
rod.

"JW" wrote:

> SumIf. Example below is assuming that the employee ID is in column A
> of both sheets and that the hours taken is in column B of sheet2. It
> is also assuming that we are dealing with the record in A2 of sheet1.
> =SUMIF(Sheet2!A:A,Sheet1!A2,Sheet2!B:B)
> rodchar wrote:
> > hey all,
> > let's say i have a list of employee id's on sheet1. And on sheet 2 there's a
> > list of employee records vacation hours taken (1-to-many). what is the best
> > way to iterate thru sheet1 and sum up all the hours for each employee in
> > sheet2 and place the total in a new column in sheet1 next to respective
> > employee?
> >
> >
> > sheet1
> > id,name,total hours
> > 1,john doe,16
> >
> > sheet2
> > id,hours,date
> > 1,4,5/6/07
> > 1,4,12/1/06
> > 1,8,3/12/06
> >
> > thanks,
> > rodchar

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Needle in a haystack...searching for VBA code in all Excel sheets orfinding xls users of xla sheets.... CodeMonkey Microsoft Excel Programming 1 28th May 2008 06:10 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Microsoft Excel Programming 3 11th Dec 2006 05:14 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Microsoft Excel Discussion 6 29th Mar 2006 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Microsoft Excel Programming 6 29th Mar 2006 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Microsoft Excel Worksheet Functions 6 29th Mar 2006 12:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 PM.