Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Need formula

On Fri, 20 Apr 2007 12:00:03 -0700, Phxlatinoboi®
wrote:

I receive an excel spreadsheet from the managers with everyone's schedule. I
would like to automatically caculate how many hours each person works. Is
there a formula for this? I would like it caculate just the time.

I receive the information as follows

F1 G1
ALEX 10-7 RAMI 10-7
RAMI 11-8 CHAD 11-8
STEPHAN 10-7








This is pretty complicated. As Sandy intimated, it would be far, far better to
design a proper data input sheet.

If that is absolutely not possible, the following might work.

The following assumptions are made:

1. The format is as follows:
<NAME<space<StartTime<hyphen<EndTime

2. There are no <space's in <NAME.

Some format changes may be allowable, but we would have to know what they are.

Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

List the names in a column someplace: e.g. A1:A4

ALEX
RAMI
CHAD
STEPHAN


Name the range where the information is stored "tbl"

Insert/Name/Define


**Array enter** the following formula in B1, and copy/drag down to B4. To
**array-enter** a formula, after typing or pasting the formula into the cell,
hold down <ctrl<shift while hitting <enter. Excel will place braces {...}
around the formula.

B1:
=SUM(IF(ISERR(-REGEX.MID(tbl,"(?<="&$A1&"\s)"&"\d+(?=-)")),0,
-REGEX.MID(tbl,"(?<="&$A1&"\s)"&"\d+(?=-)")+
REGEX.SUBSTITUTE(REGEX.MID(tbl,"(?<="&$A1&"\s)"&". *"),"(\d+-)")+
12*(---REGEX.SUBSTITUTE(REGEX.MID(tbl,"(?<="&$A1&"\s)"&". *"),"(\d+-)")
<--REGEX.MID(tbl,"(?<="&$A1&"\s)"&"\d+(?=-)"))))


--ron


 
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 12:40 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"