+ Reply to Thread
Results 1 to 7 of 7

Problem removing cells with a value of 0

  1. #1
    Registered User
    Join Date
    04-01-2016
    Location
    Houston
    MS-Off Ver
    2016
    Posts
    4

    Problem removing cells with a value of 0

    In the image I have column B that is filling in 0's on the data I wish to remove and display in column D. So from the example in D I would like to see D2=2, D3=6, & D4=7. The code as I have it works if B has true blank cells in where the 0's are, not "" blanks the functions return.

    I tried finding a way to have the function that generates these to make true blanks for this to work but that doesn't seem possible from what I saw on the web. So I need help converting this to remove the 0's instead as I couldn't get Match() to work in place of the isblank().

    The data is randomly generated so the values won't always be the same and by the end of the project there will be close to 1,000 cells in the range it will be checking against.

    Here is the line of code used
    {=IFERROR(INDEX($B$2:$B$17, SMALL(IF(ISBLANK($B$2:$B$17), "", ROW($B$2:$B$17)-MIN(ROW($B$2:$B$17))+1), ROW(A1))), "")}

    I am using this as an array with ctrl+shift+enter.

    example.jpg

    Thanks in advance for help on how to make this happen.

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem removing cells with a value of 0

    Maybe

    {=IFERROR(INDEX($B$2:$B$17, SMALL(IF($B$2:$B$17>0,ROW($B$2:$B$17)-MIN(ROW($B$2:$B$17))+1), ROW(A1))), "")}
    Last edited by jason.b75; 04-01-2016 at 02:23 PM.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Problem removing cells with a value of 0

    Try

    =IFERROR(INDEX($B$2:$B$17, SMALL(IF($B$2:$B$17>0, ROW($B$2:$B$17)-MIN(ROW($B$2:$B$17))+1), ROW(A2))), "")

    Array entered.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Problem removing cells with a value of 0

    Not sure what you're wanting to do. See if this helps.

    Array entered**:

    =IFERROR(INDEX(B:B,SMALL(IF(ISNUMBER(B$2:B$17)*(B$2:B$17>0),ROW(B$2:B$17)),ROWS(A$1:A1))), "")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-01-2016
    Location
    Houston
    MS-Off Ver
    2016
    Posts
    4

    Re: Problem removing cells with a value of 0

    Thank you. Using <1 since I wanted to get rid of the 0's worked. >0 just gave me the 0's since it removed the other values.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Problem removing cells with a value of 0

    I don't how a test for >0 can remove values of 2,6 and & 7!

    Certainly didn't when I tried it.

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Problem removing cells with a value of 0

    Quote Originally Posted by JohnTopley View Post
    I don't how a test for >0 can remove values of 2,6 and & 7!

    Certainly didn't when I tried it.
    I think that might have been aimed at my pre-edit reply, John.

    I changed ISBLANK() to >0 but forgot to remove the nullstring true argument, so the formula was effectively doing the opposite of what it should.

+ 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. Problem while removing duplicate value using VBA
    By Vinoth R in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2014, 02:25 PM
  2. Problem with VBA for removing duplicates
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 03:24 AM
  3. problem in removing blank cells
    By paradise2sr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2013, 04:31 AM
  4. [SOLVED] Problem with removing duplicates
    By emil9216 in forum Excel General
    Replies: 2
    Last Post: 08-20-2012, 07:16 AM
  5. Excel 2007 : Problem with removing duplicates
    By emil9216 in forum Excel General
    Replies: 5
    Last Post: 02-16-2012, 01:41 PM
  6. Problem removing 0
    By jermsalerms in forum Excel General
    Replies: 5
    Last Post: 01-13-2006, 01:58 PM
  7. problem removing controls
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2005, 09:06 AM

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