Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 68
Default Help with Excel VBA


-- I have a spread sheet as follows:
In Column B1 thru B8, I have listed names of workers. In Column C1 thru C8
are cells to hold total hours work. In Column G1 thru G30 are the workers
names listed again, (not in any order, and usually more than once), and to
the right in Column H1 thru H30 are the hours worked on a single job.

I need a way to look at the name in B1, search through column G1:G30 until a
name match is found, look to the right in Column H and find the hours worked,
add them to a variable, then continue on down the list in column G for the
next match, and add those hours to the variable. When finished with G1:G30,
the total hours in the variable will be transferred to cell C1 next to the
name, and the variable reset to zero.

Then we would go down to the name in B2, and start over until finished with
all the names in column B1:B8

I know this is long, but if someone can at least help me get started I would
really appreciate the help. Select Case won't work for what I need.

--
Howard

Howard
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Help with Excel VBA

You don't need VBA. You can use the SUMIF function. E.g.,

In C1, enter

=SUMIF($G$1:$G$30,B1,$H$1:$H$30)

and fill down to C8.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 25 Aug 2009 13:59:02 -0700, Howard
wrote:


-- I have a spread sheet as follows:
In Column B1 thru B8, I have listed names of workers. In Column C1 thru C8
are cells to hold total hours work. In Column G1 thru G30 are the workers
names listed again, (not in any order, and usually more than once), and to
the right in Column H1 thru H30 are the hours worked on a single job.

I need a way to look at the name in B1, search through column G1:G30 until a
name match is found, look to the right in Column H and find the hours worked,
add them to a variable, then continue on down the list in column G for the
next match, and add those hours to the variable. When finished with G1:G30,
the total hours in the variable will be transferred to cell C1 next to the
name, and the variable reset to zero.

Then we would go down to the name in B2, and start over until finished with
all the names in column B1:B8

I know this is long, but if someone can at least help me get started I would
really appreciate the help. Select Case won't work for what I need.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 68
Default Help with Excel VBA

I tried to reply yesterday, but it didn't work. Thanks for your help. This
worked great. I had to make a couple of adjustments to tweek it, but I
really did appreciate your help. Thanks again.
--
Howard


"Chip Pearson" wrote:

You don't need VBA. You can use the SUMIF function. E.g.,

In C1, enter

=SUMIF($G$1:$G$30,B1,$H$1:$H$30)

and fill down to C8.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 25 Aug 2009 13:59:02 -0700, Howard
wrote:


-- I have a spread sheet as follows:
In Column B1 thru B8, I have listed names of workers. In Column C1 thru C8
are cells to hold total hours work. In Column G1 thru G30 are the workers
names listed again, (not in any order, and usually more than once), and to
the right in Column H1 thru H30 are the hours worked on a single job.

I need a way to look at the name in B1, search through column G1:G30 until a
name match is found, look to the right in Column H and find the hours worked,
add them to a variable, then continue on down the list in column G for the
next match, and add those hours to the variable. When finished with G1:G30,
the total hours in the variable will be transferred to cell C1 next to the
name, and the variable reset to zero.

Then we would go down to the name in B2, and start over until finished with
all the names in column B1:B8

I know this is long, but if someone can at least help me get started I would
really appreciate the help. Select Case won't work for what I need.


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



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