Need to find only rows with Y in any of 5 columns ??

aware073

Board Regular
Joined
Jun 5, 2015
Messages
54
Hey guys I have this spreadsheet where in columns N, Q, T, W, and Z there are either X's or Y's. I want to eventually only see columns that have a Y in them in any of those 5 columns and hide any that do not. I tried a simple =IF(N2=Q2=T2=W2=Z2, "HIDE","OK") in a new column so that afterwards I could sort by that and hide all the OK's, but that formula wont work for some reason. Any suggestions?


Excel 2010
ABLMNOPQRSTUVWXYZ
1PlntMaterial2100BOH5800BOH2500BOH2300BOH2700BOH
221002001141601.25Y00X00X00X00X
3210020012183631.484.268X00X767X140.991.4X00X
4210020000020215X00X00X00X00X
521002000002522X00X00X00X00X
6210020000066543X40X00X00X00X
721002000011523018X2184X10312X00X00X
821002000012923722X12510X419X6612X00X
921002000016863X00X00X00X00X
1021002000017583X22X00X00X00X
11210020000176173X122X00X00X00X
12210020000177113X101X00X00X00X
13210020000181123X161X00X00X00X
1421002000027452X00X00X11X23Y
15210020000295232X10X00X61X12Y
16210020000297152X00X00X12Y01Y
1721002000035211X00X00X12Y02Y
1821002000044642X00X97X32X33X
1921002000044942X40X01Y00X00X
2021002000045362X00X00X04Y013Y
21210020000497315X60X00X00X00X
2221002000056722X50X42X11X02Y
2321002000057042X00X00X00X00X
2421002000057152X00X00X00X00X
2521002000058322X00X00X11X13Y
Over Max
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
To clarify your terminology: are you looking to hide ROWS or COLUMNS? From your description, it seems like you're actually looking for a row-by-row thing.
This would hide rows 2, 14:17, 19:20, 22, and 25.
Otherwise, in your example, only column Q would be hidden.
 
Upvote 0
To clarify your terminology: are you looking to hide ROWS or COLUMNS? From your description, it seems like you're actually looking for a row-by-row thing.
This would hide rows 2, 14:17, 19:20, 22, and 25.
Otherwise, in your example, only column Q would be hidden.



Sorry yes rows is what I meant!!
 
Upvote 0
revcanon's formula works, just drag it down over the region you want.
If it's a huge region, it might be faster to do this via VBA. Put this code in a standard module in the visual basic editor (Insert/Module), and it will show up in your Macros list on the Developer tab:
Code:
Sub countys()
Application.ScreenUpdating = False


Dim Lastrow As Integer
Dim Teststg As String
Lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row


For i = 2 To Lastrow
     Teststf = Range("N" & i) & Range("Q" & i) & Range("T" & i) & Range("W" & i) & Range("Z" & i) '//concatenates
     Range("AA" & i).Select
        Selection = InStr(1, Teststf, "y") '//counts the "y"s
        If Selection = 0 Then
            Selection.EntireRow.Hidden = True '//when a row has no Ys in target columns, this hides that row
        End If
Next i
Application.ScreenUpdating = True


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,248
Messages
6,123,866
Members
449,129
Latest member
krishnamadison

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top