Computing.Net > Forums > Office Software > multiple values in excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

multiple values in excel

Reply to Message Icon

Name: groverman85c
Date: November 2, 2007 at 03:00:18 Pacific
OS: pc
CPU/Ram: dn
Product: dn
Comment:

is there a way to format a cell so that you can put multiple values in it? for example

1,2,3,4
1,3,4
1
2
1,3

then i can search for those values/ filter the values? thanks




Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: November 2, 2007 at 09:55:18 Pacific
Reply:

I'm assuming you want to filter on an individual value, e.g. filtering on 3 would hide rows 3 and 4.

I don't know of a way to use Excel's AutoFilter feature with this type of data, but this macro will do something similiar, e.g. filtering on 3 will hide rows 3 and 4.

It includes code to Show All by default and will Show All and tell the user if the requested value is not found.

It does not however, present a list of unique values to choose from. That could be done, but it would take a bit more code...and time. ;-)


Sub FindVal()
Dim MyRange As Range
Set MyRange = Range("A1:A5")
'Get value from user
MyValue = Application.InputBox _
(Prompt:="Enter Value to Filter On, Click OK to Show All", _
Title:="Value Filter", _
Default:="Show All")
'Exit if user cancels
If MyValue = False Then Exit Sub
'Show All by default
If MyValue = "Show All" Then
MyRange.EntireRow.Hidden = False
Exit Sub
End If
'Make all rows visible then hide those without value
Range("A1:A5").EntireRow.Hidden = False
With MyRange
Set c = .Find(MyValue, lookat:=xlPart)
If Not c Is Nothing Then
For Each cell In MyRange
If Not cell Like "*" & MyValue & "*" _
Then cell.EntireRow.Hidden = True
Next
Exit Sub
Else
'Inform user if value not found
MsgBox MyValue & " Not Found"
End If
End With
End Sub


0
Reply to Message Icon

Related Posts

See More


Word 2003 and docs open s... word document view



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: multiple values in excel

printing multiple worksheets in excel in colo www.computing.net/answers/office/printing-multiple-worksheets-in-excel-in-colo/9395.html

counting multiple values in one cell www.computing.net/answers/office/counting-multiple-values-in-one-cell/9442.html

Negative time values in Excel www.computing.net/answers/office/negative-time-values-in-excel/5687.html