+ Reply to Thread
Results 1 to 9 of 9

how do I add values prefixed with a letter

  1. #1
    Forum Contributor
    Join Date
    08-08-2008
    Location
    Belfast
    Posts
    112

    how do I add values prefixed with a letter

    Hi guys this is prob really easy easy to do but I'm stumped.

    I have a column which I simply enter overtime hours into and it is totalled up at the bottom, easy. I now have to on given days enter TOIL taken (time of in lieu) I'm thinking to distinguish from overtime hours entering it as T2 for 2 hrs TOIL etc. Is there a way that this entry can be added up recognising the T infront of the number. So far I've tried this =COUNTIF(C6:AG6,"t*") which allows me to enter T and a value but it only counts the number of times I enter a value of T3 etc and not the total. Hope that is as clear as mud. If I'm going down the wrong avenue then please point in the right direction.

    Thanks in advance
    Last edited by Davycc; 08-08-2008 at 01:52 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =SUMPRODUCT(--(A1:A10<>""))*(MID(A1:A10,2,999)+0)
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    08-08-2008
    Location
    Belfast
    Posts
    112
    If I attached a copy of the book would that help

  4. #4
    Forum Contributor
    Join Date
    08-08-2008
    Location
    Belfast
    Posts
    112
    This may help guys
    Attached Files Attached Files

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Sumif is like Countif... only it sums instead of counts...

    e.g.

    =SUMIF(C6:AG6,"t*")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Forum Contributor
    Join Date
    08-08-2008
    Location
    Belfast
    Posts
    112
    Sorry I must be stupid lol I've entered =SUMIF(C6:AG6,"t*") into AM6 and entered values into any of the cells C6 through AG6 and nothing happens

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    how do I add values prefixed with a letter

    Using your sample workbook, if you want to total the
    numeric part of the T-values (eg T4+T6=10)...try this:

    Please Login or Register  to view this content.
    For that line in your workbook, the formula returns: 10

    Am I on the right track here?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  8. #8
    Forum Contributor
    Join Date
    08-08-2008
    Location
    Belfast
    Posts
    112
    Ron your a star. Thanks guys I may get home tonight after all.

    I WILL BE BACK lol

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Sorry... I wasn't think straight... the Sumif won't work in this case because of the T in front and the fact that you can't really manipulate the Criteria part too much in this function...

    I would try Sumproduct, like this:

    =SUMPRODUCT((LEFT(C6:AG6)="t")*("0"&MID(C6:AG6,2,10)))

    Edit: Looks like Ron beat me to it.. but we were thinking alike

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1