Thread: formula for sum
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default formula for sum

On Sat, 7 Nov 2009 21:45:01 +0300, "afdmello"
wrote:

In a worksheet I have 30 or 31 days in a month marked ina row
For overtime I am using the following rule

B for one rate, C for another and then writing the number of hours beside
the letter for eg
B2 stands for 2 hours OT
B10 stands for 10 hours OT
similarly C2 stands for 2 hours OT with C rate

My intention is for excel to find out all the B's and ONLY sum the
numbers(hours) beside them and give the result In a cell for the month
Similarly for C rate find the Sum and give the result in another cell

Hope you gurus can generate something to ease my troubles of manaul counting
Afd


Assuming that there is never both B and C for the same day (cell), and
that the data for a month is in cells A2:AE2, try the following
formula for finding the total hour for B rate:

=SUMPRODUCT(IF(ISNUMBER(--SUBSTITUTE("0"&A2:AE2,"B","")),--SUBSTITUTE("0"&A2:AE2,"B",""),0))

Note: This is an array formula and has to be confirmed bu
CTRL+SHIFT+ENTER rather than just ENTER.

Replace B with C to get the total hours for C rate.

Hope this helps / Lars-Åke