+ Reply to Thread
Results 1 to 11 of 11

SUMPRODUCT returning #VALUE due to blank cells

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    13

    SUMPRODUCT returning #VALUE due to blank cells

    A screenshot of my sample data is attached.

    This is my formula that counts the number in the cell if it's preceeded with a 'H'.

    =SUMPRODUCT((LEFT(B5:G5,1)="H")*(RIGHT(B5:G5,LEN(B5:G5)-1)))

    The only problem is that it returns #VALUE if one of the cells in the range B5:G5 is blank.

    The range is much larger on my actual data but I'm just working with sample data to get the formula right.

    Any help much appreciated.
    Attached Images Attached Images
    Last edited by A2H GO; 10-29-2011 at 05:41 AM.

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: SUMPRODUCT returning #VALUE due to blank cells

    If you only have one condition, why not use COUNTIF()?

    =COUNTIF(B5:G5,"H*")

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: SUMPRODUCT returning #VALUE due to blank cells

    Hi, thanks for your help.

    My formula needs to count the number next to the letter in each cell.

    So in the row the cells might contain H5, H5, H1 etc, so the total would be 11.

    Its a holiday planner so people enter either H for Holiday followed by the number of hours or a selection of other prefixes like T for Training.

    I'm then using this formula to create a summary of 'Holiday' hours and 'Training' hours etc.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT returning #VALUE due to blank cells

    One way:

    =SUM(IF(LEFT(B5:G5,1)="H",--RIGHT(B5:G5,LEN(B5:G5)-1)))

    confirmed with CTRL+SHIFT+ENTER not just ENTER
    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.

  5. #5
    Registered User
    Join Date
    10-28-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: SUMPRODUCT returning #VALUE due to blank cells

    That works perfectly! Many thanks!

    My only worry is that when new people are added to the sheet, the formulas are just dragged down, will this still be OK given I had to press CTL + SHIFT when entering?

    I just tried dragging it down and it seems fine...

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT returning #VALUE due to blank cells

    Yes, once you confirmed it the first time, you can copy it down and it will "hold" the confirmation..

  7. #7
    Registered User
    Join Date
    10-28-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: SUMPRODUCT returning #VALUE due to blank cells

    Brilliant. Can you leave 'Rep' on here? Or mark this as solved?

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT returning #VALUE due to blank cells

    You can do both.

    To leave rep, click the "libra or balances" icon.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMPRODUCT returning #VALUE due to blank cells

    This version should work OK with blanks......retaining SUMPRODUCT so you don't need "array entry"

    =SUMPRODUCT((LEFT(B5:G5)="H")+0,(0&MID(B5:G5,2,9))+0)
    Audere est facere

  10. #10
    Registered User
    Join Date
    10-28-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: SUMPRODUCT returning #VALUE due to blank cells

    Both work really well, I think Ill go with the second to make it easier for other people to amend the worksheet.

    The only problem I'm having is when quarter of hours are entered, eg. H7.25 for 7 and a quarter hours, it rounds up to 7.3....

    Edit, that was easy enough, I just needed to format the cell to 2 decimal places!
    Last edited by A2H GO; 10-29-2011 at 05:19 AM.

  11. #11
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: SUMPRODUCT returning #VALUE due to blank cells

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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