+ Reply to Thread
Results 1 to 6 of 6

Delete rows with zeroes

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-30-2008
    Location
    Los Angeles
    Posts
    144

    Delete rows with zeroes

    Attached is a file showing two groups. The first group shows the results of ten tests. I am trying to find a macro or function that will show only those tests that have a result of at least 1 (the second group in the file).

    Filtering is no good as the users won't be able to manipulate the data. I appreciate any help you guys can offer.......

    Max
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete rows with zeroes

    Not sure what you're going to do next, and sometimes "examples" like the one you posted are hard to implement into your real situation, but this is one way to filter small sets of data like that.

    On your sheet, in C18, enter this formula and press CTRL-SHIFT-ENTER to activate an array. You'll see braces { } appear around your formula and "Test 1" will appear. If you get an error, press F2 and CTRL-SHIFT-ENTER to try again.

    =IF(ROWS($C$19:C19)>COUNTIF($D$4:$D$13,">0"),"",INDEX($C$4:$C$13,SMALL(IF($D$4:$D$13>0,ROW($A$1:$A$10),""),ROWS($C$19:C19))))

    Then in D18 this formula for the score:

    =IF(C18="","",INDEX($D$4:$D$13,MATCH(C18,$C$4:$C$13,0)))

    Now copy those two cells down as far as you need.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    10-30-2008
    Location
    Los Angeles
    Posts
    144

    Re: Delete rows with zeroes

    I gave it a quick try and it "kinda" worked. I need to sit down and go through it to make sure. In the meantime, thanks...........

    Max

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete rows with zeroes

    If you have a real-world document you need help applying those formulas to, let me know. The arrays are a little tricky, but easy once you get used to them and pressing CSE.

  5. #5
    Registered User
    Join Date
    03-13-2009
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows with zeroes

    See message below.
    Last edited by bill2073; 03-14-2009 at 01:46 PM.

  6. #6
    Registered User
    Join Date
    03-13-2009
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows with zeroes

    Give this macro a try...Bill

    Sub find()
    '
    ' find Macro
    ' Macro recorded 3/13/2009 by Microchip
    '
    Range("A1").Select
    
    Cells.find(What:="0", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
    xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
    , SearchFormat:=False).Activate
    
    For counter = 1 To 10
    
    If ActiveCell = 0 Then
    Range(ActiveCell, ActiveCell.Offset(0, -3)).Delete
    End If
    
    Cells.FindNext(After:=ActiveCell).Activate
    On Error Resume Next
    
    Next counter
    
    End Sub

+ 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