top of page

Extracting text around a string in Excel

If you need to extract text from an Excel cell which is X number of characters before and Y number of characters after a given search term, you can use the MID and MAX formulas with a nested SEARCH formula.


A formula in this format:


=MID(A2,MAX(SEARCH("stole a",A2)-35,1),70)


. . . can be set to return the number of characters before the search string equal to the value given in the MAX formula (in this example 35) and the number of characters from the start of the search string moving to the right equal to roughly half the value given for the MID formula (in this example 70).



. . . the SEARCH formula finds the position in the cell containing text where the first character of the search term appears.



The MAX formula then gets the value of the SEARCH result minus the number entered in the complete formula. In this it is case 35.



When the result from the MAX formula is fed into the MID formula, it is used to determine the position where the extraction should begin, and how many characters after that point it should include.



12 Comments


A bustling center where travelers begin and end their journeys, the Airline-Terminal facilitates a seamless flow of information and services from boarding to departure. The terminal's basic amenities are available to travelers, including as check-in desks for dropping off their bags, security checkpoints for a safe trip, and boarding gates for boarding their planes. Information desks, digital screens, and staff are all conveniently located to assist with airline schedules, gate alterations, and luggage services. From arrival to departure, the terminal's amenities—which include lounges, restaurants, and shops—ensure a productive and comfortable travel experience.

Like

Car detailing by The Detailing Mafia ensures your vehicle gets the ultimate care it deserves. From deep cleaning to advanced treatments like ceramic coating and PPF, we enhance your car's appearance and protection. Experience unmatched precision, shine, and durability with our expert detailing services designed to keep your car flawless.

More Services

graphene coating

Paint protection film

ceramic coating

PPF Coating Price

Car detailing franchise

Car Detailing Business

windshield protection film

Teflon Coating - Pros, Cons, Price

Like

Ginnigal Agency
Ginnigal Agency
6 days ago

A very warm welcome to all of you here! I am Ginnigal, one of the most loved, adored and reputed college call girls in Lucknow. I serve high profile clients of national and international fame with the best of my erotic capabilities. Opting for my services means a complete transformation in your sensual life. So, get in touch with me right away!


Like

Struggling with complex C++ assignments? MyAssignmenthelp is here to simplify your academic journey with expert guidance. Our skilled programmers provide personalized solutions tailored to your requirements, ensuring accuracy and efficiency.

With our C++ assignment help, you’ll receive well-documented code, detailed explanations, and timely delivery, helping you achieve top grades effortlessly. Whether it’s object-oriented programming or advanced algorithms, we’ve got you covered.

Choose MyAssignmenthelp for reliable, affordable, and plagiarism-free support. Get started today and excel in C++ programming!

Like

bottom of page