close

Hi, I'm creating a roster, using the values quot;Aquot; quot;Bquot; and quot;Cquot; for the different
shifts and I would like to be able to give each value the numerical value of
however many hours each shift is, without making the text in the cell change
to a number, but still be able to add up the number of hours at the end of
the line. In other words A = 8, B = 10, C = 12 and the total is 30. Hope
this makes sense. I am using MS Excel 2002. Many thanks! Mullet2262

Use like SUM ie. =SumABC(A11)

Function SumABC(ByVal rng As Range)
Dim ABCsum As Double
ABCsum = 0
For Each cell In rng
Select Case cell
Case Is = quot;Aquot;
ABCsum = ABCsum 8
Case Is = quot;Bquot;
ABCsum = ABCsum 10
Case Is = quot;Cquot;
ABCsum = ABCsum 12
End Select
Next cell
SumABC = ABCsum
End Function

quot;Mullet2262quot; wrote:

gt; Hi, I'm creating a roster, using the values quot;Aquot; quot;Bquot; and quot;Cquot; for the different
gt; shifts and I would like to be able to give each value the numerical value of
gt; however many hours each shift is, without making the text in the cell change
gt; to a number, but still be able to add up the number of hours at the end of
gt; the line. In other words A = 8, B = 10, C = 12 and the total is 30. Hope
gt; this makes sense. I am using MS Excel 2002. Many thanks! Mullet2262

Hi,
for each cell you will input shift you define cell format/define/quot;Aquot;;quot;quot; or
quot;Bquot;;quot;quot; or quot;Cquot;;quot;quot;, then you can total the numbers you have input the cells.
(the cell format for total is defined as normal numerical)

wdjsxj

“Mullet2262”编写:

gt; Hi, I'm creating a roster, using the values quot;Aquot; quot;Bquot; and quot;Cquot; for the different
gt; shifts and I would like to be able to give each value the numerical value of
gt; however many hours each shift is, without making the text in the cell change
gt; to a number, but still be able to add up the number of hours at the end of
gt; the line. In other words A = 8, B = 10, C = 12 and the total is 30. Hope
gt; this makes sense. I am using MS Excel 2002. Many thanks! Mullet2262

Hi,

With your data in A1:A3, enter this formula into your total cell:

=SUM(COUNTIF(A1:A3,quot;Aquot;)*8 COUNTIF(A1:A3,quot;Bquot;)*10 CO UNTIF(A1:A3,quot;Cquot;)*12)

Ewan.

quot;Mullet2262quot; wrote:

gt; Hi, I'm creating a roster, using the values quot;Aquot; quot;Bquot; and quot;Cquot; for the different
gt; shifts and I would like to be able to give each value the numerical value of
gt; however many hours each shift is, without making the text in the cell change
gt; to a number, but still be able to add up the number of hours at the end of
gt; the line. In other words A = 8, B = 10, C = 12 and the total is 30. Hope
gt; this makes sense. I am using MS Excel 2002. Many thanks! Mullet2262


Hello

Try this

=CODE(UPPER(A1))-64

Matt--
Flintstone
------------------------------------------------------------------------
Flintstone's Profile: www.excelforum.com/member.php...oamp;userid=15310
View this thread: www.excelforum.com/showthread...hreadid=519998Hi all,

Thank you all for your fast replies - I really appreciate them. What I
really should have added in my original message was that I know how to use
Excel on a basic level but not advanced formula level - sorry!!!!

Perhaps it would help if I expanded on my requirements:

Across the top of the spreadsheet will be the dates for that month - so 1/1,
2/1, 3/1 and so on to the 28/1 in each cell (A!: AB1)

Down the side of the ss will be the names of the 5 staff working the
shifts.(A2:A7)

There are three shifts available (ultimately there will be more than this -
up to 20 staff picking up varius shifts through the month but that comes
later - for now just focussing on the 5 senior staff) - A(7-4), B(2-11)
C(11-8) These are 9 hour shifts but later the hours will vary acording to
shift requirements.

At the end of each row(AC1), I would like to be able to add up each row so
that the total is the number of hours for that row - that way, I can see if
that staff is over or under the number of hours required in their contract
for the month. It saves having to add up the hours every time a change is
made - and rosters are a hair pulling exercise, bad enough when you have 5
staff but very frustrating when you have 20 or more staff to do on the one
roster - you get sick of adding the shifts up to make sure each line works
out. It is no good manually inputting the hours (8,9 etc) in each cell in
each row because that does not tell me which of the shifts they have and thus
covering the 24 hours of that day.

So, I'm after a way to be able to enter the text A, B or C or even A1, B1
etc and it will remember that as the numeric value for that text and add the
values up at the end of each row.

Hope all this makes sense again.

Again, thank you all for taking the trouble to help - I really appreciate it!!

Mullet2262

If the shift lengths are going to change then where will you store that
information? You'll only be able to do what you want if you can
reference the correct shift lengths.

Going by your original example where A = 8, B10 and C=12 then to
calculate total hours for the row B2:AB2 you could use this formula in
AC2

=SUMPRODUCT(COUNTIF(B2:AB2,{quot;Aquot;,quot;Bquot;,quot;Cquot;}),{8,10,12 })--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: www.excelforum.com/member.php...oamp;userid=30486
View this thread: www.excelforum.com/showthread...hreadid=519998

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()