Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, I'm creating a roster, using the values "A" "B" and "C" 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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Use like SUM ie. =SumABC(A1:D1)
Function SumABC(ByVal rng As Range) Dim ABCsum As Double ABCsum = 0 For Each cell In rng Select Case cell Case Is = "A" ABCsum = ABCsum + 8 Case Is = "B" ABCsum = ABCsum + 10 Case Is = "C" ABCsum = ABCsum + 12 End Select Next cell SumABC = ABCsum End Function "Mullet2262" wrote: Hi, I'm creating a roster, using the values "A" "B" and "C" 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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
for each cell you will input shift you define cell format/define/"A";"" or "B";"" or "C";"", then you can total the numbers you have input the cells. (the cell format for total is defined as normal numerical) wdjsxj €œMullet2262€ç¼–写: Hi, I'm creating a roster, using the values "A" "B" and "C" 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 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
With your data in A1:A3, enter this formula into your total cell: =SUM(COUNTIF(A1:A3,"A")*8+COUNTIF(A1:A3,"B")*10+CO UNTIF(A1:A3,"C")*12) Ewan. "Mullet2262" wrote: Hi, I'm creating a roster, using the values "A" "B" and "C" 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 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hello Try this =CODE(UPPER(A1))-64 Matt -- Flintstone ------------------------------------------------------------------------ Flintstone's Profile: http://www.excelforum.com/member.php...o&userid=15310 View this thread: http://www.excelforum.com/showthread...hreadid=519998 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi 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 |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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,{"A","B","C"}),{8,10,12 }) -- daddylonglegs ------------------------------------------------------------------------ daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486 View this thread: http://www.excelforum.com/showthread...hreadid=519998 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Giving Months Numerical Values | Excel Discussion (Misc queries) | |||
Return Numerical Label for LAST value Subtracted to reach Sum Target Value | Excel Worksheet Functions | |||
hOW CAN I CONVERT NUMERICAL POINTS INTO A LETTER GRADE(SCHOOL) | Excel Worksheet Functions | |||
Convert Text (letter) To Number Excel | Excel Worksheet Functions | |||
numerical value of a letter | Excel Worksheet Functions |