Consulting

Results 1 to 5 of 5

Thread: summing a column with blank cells and replacing the blanks with a value in the sum

  1. #1

    summing a column with blank cells and replacing the blanks with a value in the sum

    Hi All,

    I have what I think is an odd request.

    I have the attached excel sheet and in column A (Range A1:A10) have values of either 8 or a blank. If I do a sum of A1:A10 I will get 56 however I want the sum to calculate if a cell is blank then add the value of 8. In this case the expected solution for range A1:A10 should be 80.

    I'm not sure how to go about this or if it's even possible.

    I'm able to do it with a helper cell but wondering if I can do it in just one formula without the use of a helper cell.

    Any help will be appreciated.

    Thanks
    Attached Files Attached Files

  2. #2
    Hello
    May be
    =SUM(SUMIF(A1:A10,8,A1:A10),COUNTIF(A1:A10,"")*8)

  3. #3
    Thanks YasserKhalil, much appreaciated. I have a follow up question though. If my values are instead in hh:mm:ss how will I write the formula?

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    =SUM(SUMIF(A1:A10,TIMEVALUE("08:00:00"),A1:A10),COUNTIF(A1:A10,"")*8/24)

    Use custom number format [h]:mm:ss to display result
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Thanks mdmackillop for the help. Much appreciated.

Posting Permissions

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