View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
barry houdini[_4_] barry houdini[_4_] is offline
external usenet poster
 
Posts: 57
Default Excel Formula, text & number in cell

On Dec 29, 9:44*pm, Need a Guru
wrote:
I need your help, thank you for taking the time! :o)
I am making a spreadsheet to calculate time away from work. I would like to
be able to enter 8 PTO (8 hours paid time off) and another cell calculates
how many times that was entered in a column and adds that for me
automatically. My spreadsheet has the calendar, so all a person needs to do
is input the hours and the type of time taken (we also have holiday time; HT)
and it will automatically add it up for them. Please help! Thanks again!


It's probably easier if you enter hours in one cell and type of time
taken in another, then you can use a simple SUMIF to add up "PTO"
hours, e.g.

=SUMIF(A1:A10,"PTO",B1:B10)

where hours are in B1:B10 and type in A1:A10

.....but if you want it all in one cell then try a formula like this

=SUM(IF(RIGHT(A1:A10,LEN(C2))=C2,LEFT(A1:A10,FIND( " ",A1:A10)-1)+0))

This is an array formula which needs to be confirmed with CTRL+SHIFT
+ENTER so that curly braces appear around the formula in the formula
bar

C2 should contain the text, e.g. PTO