Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search multiple lines

Posted on 2016-10-13
3
Medium Priority
?
49 Views
Last Modified: 2016-10-17
Is it possible to search a cell for a particular line and put it in another cell.

For example
=findLine(A2,"Short Results:")

Open in new window


Where in A2 holds:-

SUMMARY
------------------------------------------------------------------
Short Results: Nothing to be done
Operation completed at 18:29:33 on 12/10/2016
Total duration: 00:29:30
------------------------------------------------------------------

And the result of the fomula will be:-
Nothing to be done

If there isnt then Ill make my own function in VBA, just thought Id ask
0
Comment
Question by:tonelm54
[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 53

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41841839
Hi,

pls try
Function FindLine(rng As Range, strText As String) As String
For Each Ln In Split(rng.Value, Chr(10))
    If Trim(Ln) Like strText & "*" Then
        Res = Trim(Mid(Trim(Ln), Len(strText) + 1))
        Exit For
    End If
Next
FindLine = Res
End Function

Open in new window

Regards
0
 
LVL 23

Expert Comment

by:NBVC
ID: 41841847
Perhaps something like:

=TRIM(IF(ISNUMBER(FIND("Short Results:",A2)),MID(A2,LEN("Short Results:")+1,FIND(CHAR(10),A2)-LEN("Short Results:")),""))
1
 
LVL 23

Expert Comment

by:Danny Child
ID: 41843462
Do you just want to check a bunch of cells that contain multiple lines for the "Short Results:" text entry, and if found, display "Nothing to be done" ?

if so, try this:
=IF(FIND("Short Results:",A2)>0,"Nothing to be done","")
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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…

636 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