If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Doing a for each for a whole bunch of cells

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-05, 18:24
troystevens troystevens is offline
Registered User
 
Join Date: Feb 2005
Posts: 27
Doing a for each for a whole bunch of cells

Hi,

I have an Excel app which acts as a timesheet. I want to be able to loop thru several cells using a for each statement and see if their are any hours greater than 8 for a particular day and if so, accumulate hours in an OT entitlement field at the bottom of the sheet. Are there any ideas on how to do this?
Reply With Quote
  #2 (permalink)  
Old 11-07-05, 20:57
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
You can do it with a formula or Visual Basic.
See this post about doing an Array or Index formula to add values based on criteria:
Vlookup on more than one column?

Code:
To start with I subtracted Start time from End Time and multiplied
by 24 to get a number format from the the Start and End values formated
as Time.

If C3 is the End time and B3 the Start, this is the formula.
=(C3-B3)*24

Array Formula to Sum Column 'D':
{=SUM((D2:D7>8)*D2:D7)}
(Use Ctl+Shft+Enter to apply a formula as an Array Formula
 that will add the Curly Brackets and apply the array)

A subtotal formula will total values in a filtered set of records.
Use a subtotal with a custom filter to show values greater than 8.
=SUBTOTAL(9,D2:D7)
Attached Images
File Type: gif timecalc.gif (5.2 KB, 35 views)
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 11-08-05, 11:46
troystevens troystevens is offline
Registered User
 
Join Date: Feb 2005
Posts: 27
Thanks

Thanks a million Bill!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On