Excel - find string in multiple cells and create list

Posted on 2012-09-05
Medium Priority
Last Modified: 2012-09-05
I have an Excel file with server names in column A and and errors in column D. I want to create a list of servers that contain specific text from column D.

Say I have 50 servers. In the error list I want to know how many servers have the error reading " Account Lockout Threshold" so I can identify which ones need to be remedied of this particular issue. The D column has multiple lines of text with errors. Does anyone have any ideas on how I can isolate each error and identify each server with this error?

I've attached the file for referencing.
Question by:P0larb3ar
LVL 24

Expert Comment

ID: 38368892
Place this formula in E1 and copy down:

=IFERROR(FIND("Account Lockout Threshold",D1),"NO")

or this one (2003 compliant)

=IF(ISERROR(FIND("Account Lockout Threshold",D1)),"NO","YES")
LVL 21

Expert Comment

ID: 38368905
=FIND("Account Lockout Threshold",D1,1)
LVL 39

Accepted Solution

nutsch earned 2000 total points
ID: 38368956
With the attached macro, you can convert your data into a proper list, that you can filter, pivot, etc.


Sub SplitCellsAndExtend_New()
'takes cells with inside line feeds and creates new row for each.
'reverses merge into top cell.

'turn off updates to speed up code execution
With application
    .ScreenUpdating = False
    .EnableEvents = False
    .Calculation = xlCalculationManual
End With

Dim strCell As String, lastRow As Long, lRowLoop As Long, j As Long, arSplit
application.ScreenUpdating = False

Const lColSplit As Long = 4
Const sFirstCell As String = "A1"
Dim sSplitOn As String
sSplitOn = Chr(10)

lastRow = Cells(Rows.Count, lColSplit).End(xlUp).Row

    For lRowLoop = lastRow To 1 Step -1
        arSplit = Split(Cells(lRowLoop, lColSplit), sSplitOn)
        If UBound(arSplit) > 0 Then
            Rows(lRowLoop + 1).Resize(UBound(arSplit) + 1).Insert
            Cells(lRowLoop, lColSplit).Resize(, UBound(arSplit) + 1).Value = arSplit
            Cells(lRowLoop, lColSplit).Resize(, UBound(arSplit) + 1).Copy
            Cells(lRowLoop + 1, lColSplit).PasteSpecial Transpose:=True
            Cells(lRowLoop, 1).Resize(, lColSplit - 1).Copy Cells(lRowLoop + 1, 1).Resize(UBound(arSplit) + 1)
        End If
        Set arSplit = Nothing
With application
    .ScreenUpdating = True
    .EnableEvents = True
    .Calculation = xlCalculationAutomatic
End With

End Sub

Open in new window


Author Closing Comment

ID: 38370271
Worked like a champ! Thank you Thomas.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

829 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