Solved

how can i select cells with certain value in excel over numeric cells treating them as string values

Posted on 2012-03-16
3
171 Views
Last Modified: 2012-04-01
hi

i have an excel sheet with numeric values at  column D

i need to select rows who contain value 889490 at any record at column D

someone know how to do this via excel or vba?

thanks
MINUTA-2284820110311.xls
0
Comment
Question by:tenriquez199
3 Comments
 
LVL 41

Expert Comment

by:dlmille
ID: 37731480
Do you want to select them all at once?  You'll need to add a helper column to search by text.

E.g., column M2 and copy down:
[M2]=Text(D2,"0#")

Add column M to the filter, then search on contains 889490

See attached.

Dave
MINUTA-2284820110311.xls
0
 
LVL 18

Expert Comment

by:krishnakrkc
ID: 37732006
Hi

Or

in K2

=RIGHT(D2,6)="889490"

go to Data > Advanced Filter > Check on 'Filter the list, in place'

list range: A1:I827
criteria range: k1:k2

click ok.

Also see the attached image.

Kris
AdvFilter.JPG
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 37733414
This code will iterate the column D values and select the rows that meet the pattern you supply.

Option Explicit

Public Sub FilterNumberAsText(parmSearchForPattern As String)
    Dim wks As Worksheet
    Dim rng As Range
    Dim rngCell As Range
    Set wks = ActiveSheet
    For Each rngCell In wks.Range("D2", wks.Range("D2").End(xlDown))
        If rngCell.Value Like parmSearchForPattern Then
            If rng Is Nothing Then
                Set rng = rngCell.EntireRow
            Else
                Set rng = Union(rng, rngCell.EntireRow)
            End If
        End If
    Next
    rng.Select
End Sub

Open in new window


Here is an invocation of the routine, looking for the 889490 value at the end of the number.
FilterNumberAsText "*889490"

Open in new window


Here is an invocation of the routine, looking for the 889490 value anywhere in the number.
FilterNumberAsText "*889490*"

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question