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
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

752 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