+ Reply to Thread
Results 1 to 3 of 3

Dealing with #DIV/0!

  1. #1
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Question Dealing with #DIV/0!

    I have a bit of a problem and I'll try to be brief. I have a small 4 col - 20 row table.
    Col 1 (C4-C23) is the count of products received.
    Col 2 (D4-D23) is the total cost of the product received.
    Col 3 (E4-E23) indicates whether the delivery is a unit or a case.
    Col 4 (F4-F23) contains a formula which divides the cost by the case or the unit cost (In this case the divisor is 24, cause we're talkin beer)

    Above the table in cell F3 I have manually entered the previous unit cost and I want to average the unit cost at the bottom of the F col in cell F24. The two formulas I hve tried in cells f4-23 are:

    =IF(E4="c",(D4/C4)/24,D4/C4) or =IF(AND(D4>0,E4="c"),(D4/C4)/24,D4/C4)

    Both work, but my problem is that I am trying to average Col F in cell F24 and I don't know how to deal with #DIV/0!.

    My work around has been to enter a 1 in all the count columns and use the following formula in cell F24: =SUM(F3:F23)/COUNTIF(F3:F23,">0"). Seems to work okay, but us old folk like to be neat.

    Any help would be greatly appreciated.

    Dean

  2. #2
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    Dean
    Your getting the #DIV/0 error because your dividing by zero probably in the other formulas. Try this for your Cost/Unit column

    =IF(AND(C2>0,D2>0),IF(E2="c",(D2/C2)/24,D2/C2),"")

    Then put a regular AVERAGE formula in F24

    =AVERAGE(F2:F23)

    HTH

    Jason

  3. #3
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Talking

    Jason,

    Works like a charm. Thanks a bunch! Greatly appreciated

    Dean

+ 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