+ Reply to Thread
Results 1 to 9 of 9

SUMIF - sum the numbers in any cell starting with 'hh'.. ?

  1. #1
    Registered User
    Join Date
    11-25-2014
    Location
    Lincoln, UK
    MS-Off Ver
    2010
    Posts
    19

    Exclamation SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Hi all,

    Not sure if this is possible, I cannot find anything across the net that matches what i neeed as yet. Would be grateful if anyone can help?

    I have a log of holidays - this is for full time and part time workers. For the full time workers we simply log a 'h' for holidays. For the part timers, the log was developed by someone else (not me) to have to enter 'hh' and the number of hours i.e. 'hh4.5'. There was then a second row which used '=left(....' to pull through the number, and sum up at the end.

    I want to remove the need for this second row on part-time as it causes lots of formula problems, as well as formatting.

    Does anyone know how I can sum the numbers in these cells? I have played with SUMIF, but dont how to incorporate the "if it starts with 'hh' then sum the number after 'hh'"....

    Capture.JPG

    Many thanks in advance
    Ashleigh

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    =SUMPRODUCT(--(IF(SUBSTITUTE(B3:I3,"h","")="",0,SUBSTITUTE(B3:I3,"h",""))))
    Array formula, use Ctrl-Shift-Enter
    where row 3 is your green coloured cells and B3 contains HH8
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Please Login or Register  to view this content.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  4. #4
    Registered User
    Join Date
    11-25-2014
    Location
    Lincoln, UK
    MS-Off Ver
    2010
    Posts
    19

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Hi Special-K - works perfectly when applied to row 3 as you say!

    My actual data is row 5, with the 'hh' starting in v5, and I cant seem to just shift the ref/range...?

    thanks

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    If I understand your explanation you want to sum:

    HH8 + HH2 + HH1.5 for a total of 11.5

    Is that correct?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Adjust ranges as needed

    ***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Data Range
    B
    C
    D
    E
    F
    G
    H
    I
    1
    2
    HH8
    H
    HH2
    H
    HH1.5
    H
    3
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    This array formula**:

    =SUM(IF(LEFT(B2:I2,2)="HH",--MID(B2:I2,3,5)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  8. #8
    Registered User
    Join Date
    11-25-2014
    Location
    Lincoln, UK
    MS-Off Ver
    2010
    Posts
    19

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    Thanks Tony Valko - worked perfectly :-)

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF - sum the numbers in any cell starting with 'hh'.. ?

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] sum numbers over several sheets with varing starting / ending point
    By hänschendampf in forum Excel General
    Replies: 13
    Last Post: 03-30-2016, 11:26 AM
  2. Round up numbers starting with. 2
    By Mjh35 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2014, 04:30 AM
  3. [SOLVED] Worksheet with Page numbers starting from a set number
    By Deventus in forum Excel General
    Replies: 4
    Last Post: 09-03-2014, 07:23 PM
  4. [SOLVED] Defining cell names starting with numbers?
    By Onyxalis in forum Excel General
    Replies: 5
    Last Post: 11-25-2013, 10:33 AM
  5. Replies: 5
    Last Post: 10-21-2005, 03:05 AM
  6. [SOLVED] how do i enter numbers starting with zero in excel
    By achitsyerself in forum Excel General
    Replies: 3
    Last Post: 05-12-2005, 04:06 PM
  7. Replies: 2
    Last Post: 01-12-2005, 08:06 PM

Tags for this Thread

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