?
Solved

Search multiple lines

Posted on 2016-10-13
3
Medium Priority
?
45 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 52

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

800 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