+ Reply to Thread
Results 1 to 9 of 9

#DIV/0 error ... Skip rows with 0.00 in formula

  1. #1
    Forum Contributor mikehk's Avatar
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    483

    #DIV/0 error ... Skip rows with 0.00 in formula

    this formula works perfectly fine when all rows have numbers
    =([@LastPrice]/[@2005o])^(1/(COUNTIFS(Table3[[#Headers],[2020o]:[2005c]],"*o")))-1

    when some of the cells (in rows) are 0.00 ...I get #DIV/0! error.
    I had like to skip the rows with 0 and do the math.

    Don't know how to do Please help.

    I attach a sample file.

    Thank you.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Try this...
    =IF(AF5=0,"",([@LastPrice]/[@2005o])^(1/(COUNTIFS(Table3[[#Headers],[2020o]:[2005c]],"*o")))-1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Try to drag your formula with IFERROR(formula,0)
    Quang PT

  4. #4
    Forum Contributor mikehk's Avatar
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    483

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Quote Originally Posted by FDibbins View Post
    Try this...
    =IF(AF5=0,"",([@LastPrice]/[@2005o])^(1/(COUNTIFS(Table3[[#Headers],[2020o]:[2005c]],"*o")))-1)
    sorry, maybe I didn't explain correctly. some of the rows are 0.00 (cells AB5:AG5) ...maybe in future some of the rows (more/less)
    maybe with 0 so I believe COUNT formula may suit better, but I don't know how to write one.

    Thank you.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,572

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    If I understand correctly the bebo's suggestion does what you want. I.E. =IFERROR(([@LastPrice]/[@2005o])^(1/(COUNTIFS(Table3[[#Headers],[2020o]:[2005c]],"*o")))-1,0)
    If that doesn't produce the desired result then please tell us what you would expect to see in cell AX5 if you were doing manual calculations.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Forum Contributor mikehk's Avatar
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    483

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Thank you Bebo and JeteMe. Your formula works fine, the COUNTIFS formula counts all cells with "o", it shouldn't count
    cells that have 0.00.

    I tried with AND function but don't seem to get it right...please help to modify.

    (COUNTIFS(AND((Table3[[#Headers],[2020o]:[2005c]],"*o"),(Table3[2020o]:[2005c]>0)

    I have attached sample file that produce the desired result.

    Thank you.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,572

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Modifying Ford's formula as follows produces the desired result in cell AX5:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Should the formula automatically find the value in [@2008o]?
    If so then try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  8. #8
    Forum Contributor mikehk's Avatar
    Join Date
    09-05-2017
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    483

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    Thank you soooooo much JeteMc
    The 2nd formula is the one I wanted.

    Thanks again.
    Have a lovely day and great weekend ahead.

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,572

    Re: #DIV/0 error ... Skip rows with 0.00 in formula

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. How to skip rows in an array with the following formula? Need Help
    By frawji in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-11-2016, 09:37 PM
  2. Skip rows in a formula
    By mhkeys in forum Excel General
    Replies: 11
    Last Post: 02-04-2016, 10:18 PM
  3. [SOLVED] Drag down formula to skip 2 rows.
    By StudioLETA in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-12-2015, 02:14 PM
  4. How to skip rows when referencing another workbook that doesn't skip rows?
    By Julian2501 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-06-2014, 04:55 PM
  5. Excel formula skip rows help!
    By crash884 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-19-2013, 08:15 AM
  6. Drag formula but skip 27 rows
    By rhudgins in forum Excel General
    Replies: 3
    Last Post: 07-20-2010, 06:08 PM
  7. Conditional formula to skip rows
    By ukmacke in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-05-2007, 01:57 PM

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