ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter Column (https://www.excelbanter.com/excel-programming/440042-filter-column.html)

Sudipta Sen[_2_]

Filter Column
 
Hi Friends,

I want to filter data columnwise not row wise.
eg.
Stationey Purchased List

Item Jan Feb March April May June
Pen y y y y
Pencil y y y
Scale y y y
Rubber y y y y

Now I want to filter Pencil purchased in which month, means want to filter
only pencil with only purchased month, other months will be off.

First I filter Pencil then how I will get the only purchased month.

Result will be like that

Item Jan Feb April
Pencil y y y


Please help me to solve this problem.

With loves,
Sudipta


Gary''s Student

Filter Column
 
An interesting question. Try this sample:

Sub SuperFilter()
Dim r As Range
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
nLastColumn = r.Columns.Count + r.Column - 1
st = Application.InputBox(prompt:="enter item: ", Type:=2)

For i = 2 To nLastRow
If Cells(i, 1).Value < st Then
Cells(i, 1).EntireRow.Hidden = True
Else
nn = i
End If
Next

For i = 2 To nLastColumn
If Cells(nn, i).Value < "y" Then
Cells(nn, i).EntireColumn.Hidden = True
End If
Next

End Sub

It will hide the un-wanted rows AND the un-wanted columns.
--
Gary''s Student - gsnu201001


"Sudipta Sen" wrote:

Hi Friends,

I want to filter data columnwise not row wise.
eg.
Stationey Purchased List

Item Jan Feb March April May June
Pen y y y y
Pencil y y y
Scale y y y
Rubber y y y y

Now I want to filter Pencil purchased in which month, means want to filter
only pencil with only purchased month, other months will be off.

First I filter Pencil then how I will get the only purchased month.

Result will be like that

Item Jan Feb April
Pencil y y y


Please help me to solve this problem.

With loves,
Sudipta



All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com