Hi Bernard (and others)
The OP has array solutions to his problem from Bob, Sandy and Biff,
which will solve his problem.
As someone who tries to avoid array formulae when possible, I was
examining your SUMPRODUCT solution.
I decided the following simple modification will deal with situations
(should they arise) of say 10.25 hours, whereas you stated your solution
dealt with single digit values. What I did was
=SUMPRODUCT(--(LEFT(B2:F2)="s"),--(MID(TEXT(B2:F2,"00"),2,5)))
and all appeared to be well and with data in B2:F2 of s2, v4, s10.25,
empty , empty,
it produced the desired result of 12.25
However, with just a single letter "s" entered into the first empty cell
in the range, I got a #VALUE error (as I did with your formula also).
This I can fully understand, and thought about ways of solving the
problem and came up with
=SUMPRODUCT(--(LEFT(B2:F2)="s"),--(IF(LEN(B2:F2)=1,0,MID(TEXT(B2:F2,"00"),2,5))))
This still produces a #VALUE result in the cell containing the formula,
but curiously when using F9 to evaluate parts of the formula in the
formula toolbar, I get the same result of 12.25.
Using F9 on the first part produces {1,0,1,1,0} and on the second part
produces {10,25,0,2,0,0}, F9 on the whole formula produces, as I have
said, 12.25.
Do you, or anyone else, have anything to suggest as to why this is, or
what the solution might be, purely out of academic interest?
--
Regards
Roger Govier
"Bernard Liengme" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> some garbage was left over from my test - correc this to
> =SUMPRODUCT(--(LEFT(B2:F2)="s"),--(RIGHT(TEXT(B2:F2,"00"))))
>
> --
> Bernard V Liengme
> www.stfx.ca/people/bliengme
> remove caps from email
>
> "Bernard Liengme" <(E-Mail Removed)> wrote in message
> news:uPJ%(E-Mail Removed)...
>>A non-arrray solution
>> =SUMPRODUCT(--(LEFT(B2:AC2)="s"),--(--(RIGHT(TEXT(B2:AC2,"00")))))
>> the problem was what to do with empty cells - TEXT solved this
>> My solution works only when hours are one digit.
>> best wishes
>> --
>> Bernard V Liengme
>> www.stfx.ca/people/bliengme
>> remove caps from email
>>
>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi,
>>>
>>> Here is what I am trying to do:
>>>
>>> I have a spreadsheet that keeps track of employees vacation and sick
>>> time.
>>>
>>> The spreadsheet is formatted to column A is the employee name,
>>> columns
>>> B - AB are days of the month.
>>>
>>> I would like to have the manager be able to enter in the time off as
>>> either S8 or V8 (8 representing the number of hours off the employee
>>> had S = sick V = vacation).
>>>
>>> I would like Column AC to then calcuate the total sick hours and AD
>>> to
>>> calcuate the total of vacation hours.
>>>
>>> I played around with a few formulas but could not figure out a way
>>> to
>>> do it. Is there a way to have this done? What is the correct
>>> formula?
>>>
>>> Thank you very kindly for the input!
>>>
>>
>>
>
>