+ Reply to Thread
Results 1 to 6 of 6

Clearing cell based on criteria

  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    London, England
    MS-Off Ver
    Excel XP
    Posts
    174

    Clearing cell based on criteria

    Hi guys

    I've got a pretty straightforward question. I should have been able to figure this out already but for some reason cannot...hopefully someone here can help out!

    I have a column of data, lets say Column D.
    Some values in Column D have the value ' #DIV/0! '
    this is because the formula gave an error, so I want this changed to a blank cell.

    Something like

    For each cell in Column D
    If cell.Value = "#DIV/0!" Then cell.Value = ""

    Any thoughts?

    thanks
    Last edited by Pasha81; 03-19-2010 at 08:22 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Clearing cell based on criteria

    Try in your sheet

    =IF(B2=0,"",A2/B2)

    Where B2 is your divisor

    Or if you are using VBa

    Please Login or Register  to view this content.
    to aviod same error
    Last edited by Marcol; 03-19-2010 at 06:58 AM.

  3. #3
    Forum Contributor
    Join Date
    05-13-2009
    Location
    London, England
    MS-Off Ver
    Excel XP
    Posts
    174

    Re: Clearing cell based on criteria

    ? I'm not sure what you're trying to do.

    I need to change the cell to blank or "", if the value is "#DIV/0!" (which it will be as this column is copied from somewhere else- a pivot table)

    thanks for the attempt though

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Clearing cell based on criteria

    Assuming all errors are to be corrected then perhaps simply:

    Please Login or Register  to view this content.
    (above assumes the cells are values only - if formulae adjust Constants to Formulas but note the formulae will be overridden)

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Clearing cell based on criteria

    Hi Pasha

    ? I'm not sure what you're trying to do.
    I'm suggesting that you fix the error at source, not try to work round it once it happens.

    Cheers

  6. #6
    Forum Contributor
    Join Date
    05-13-2009
    Location
    London, England
    MS-Off Ver
    Excel XP
    Posts
    174

    Re: Clearing cell based on criteria

    thanks Don, works great!

+ 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