Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2024, 02:06 PM
Haha88 Haha88 is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2010 32bit
Advanced Beginner
Extract specific text from a text string Help
 
Join Date: Mar 2015
Posts: 75
Haha88 is on a distinguished road
Default Extract specific text from a text string Help


Hi Community,

Please help with an excel formula to extract text from a text string in excel.

I attached an example and what text needs extracting.

Many thanks,
Haha88
Attached Files
File Type: xlsx Extract Text from string.xlsx (9.1 KB, 5 views)
Reply With Quote
  #2  
Old 03-11-2024, 12:35 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Extract specific text from a text string Help Windows 10 Extract specific text from a text string Help Office 2021
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

You only provided ONE example. Will other strings have the same format?
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 03-11-2024, 02:53 AM
ArviLaanemets ArviLaanemets is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

For given example, the string to extract the name from is
'Contractor Stephen McWhinnie 14 hours w/e 30-Sep-23'
It looks like you want to get the name following some code string in source string, e.g. 'Contractor '. Now the conditions you haven't detailed:
1. Is there a single code string ('Contractor) indicating that the name will follow, or there may be several different ones?
2. Is the source string always starting with code string, or the code string may be placed anywhere in source string (like '<Some text here>, contractor Joe Smith ...')?
3. I will assume, that the name you want to extract always starts immediately after code string (otherwise it will be impossible to determine, from where the name starts), but how is determined, where it ends? Unless you have some other code string indicating the end of name (like ','), or you have the name always composed from single forename and single surname - i.e. the name always has a single space in it - there is no way to decide. From your example it looks like you have any numeric character ('1' in your example) in source string as second code string. I.e. the name string (probably with space in end) ends when any of numeric characters '0', '1', ..., '9' appears in source string.

Assuming that you want to extract only contractors, placed anywhere in field, and having contractor name followed with space, and then with some number, in attached is an example how to do this (I used additional calculated columns for this formula to calculate the start position of name, and the name length - because having the formula for start position of name to be inserted 10 times to calculate the length of it would surely exceed the limit for formula length).
Attached Files
File Type: xlsx Extract Text from string.xlsx (9.6 KB, 4 views)
Reply With Quote
  #4  
Old 03-12-2024, 10:48 AM
Haha88 Haha88 is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2010 32bit
Advanced Beginner
Extract specific text from a text string Help
 
Join Date: Mar 2015
Posts: 75
Haha88 is on a distinguished road
Default

Quote:
Originally Posted by Pecoflyer View Post
You only provided ONE example. Will other strings have the same format?
Thank you for looking into this matter for me. I realised it wasn't enough data, I've now attached a new sheet with more information. I hope you can help.

Many thanks,
Reply With Quote
  #5  
Old 03-12-2024, 10:51 AM
Haha88 Haha88 is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2010 32bit
Advanced Beginner
Extract specific text from a text string Help
 
Join Date: Mar 2015
Posts: 75
Haha88 is on a distinguished road
Default

Thank you for looking into this matter for me. Your formula will work if the name is at the same length/ number of character but unfortunately they are not. I have attached a revised sheet with more information and hope you can help.

Many thanks,
Reply With Quote
  #6  
Old 03-12-2024, 10:54 AM
Haha88 Haha88 is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2010 32bit
Advanced Beginner
Extract specific text from a text string Help
 
Join Date: Mar 2015
Posts: 75
Haha88 is on a distinguished road
Default

Quote:
Originally Posted by Haha88 View Post
Hi Community,

Please help with an excel formula to extract text from a text string in excel.

I attached an example and what text needs extracting.

Many thanks,
Haha88
I upload an updated sheet with more information
Attached Files
File Type: xlsx Extract Text from string updated.xlsx (9.8 KB, 2 views)
Reply With Quote
  #7  
Old 03-12-2024, 02:01 PM
ArviLaanemets ArviLaanemets is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

Quote:
Originally Posted by Haha88 View Post
Thank you for looking into this matter for me. Your formula will work if the name is at the same length/ number of character but unfortunately they are not. I have attached a revised sheet with more information and hope you can help.
To whose post does this belong to? In case to my post #4, then the formula returns a string of any length, situated between code string, and 1st occurrence of any numeric character after the code string.

Sorry, but for next 2 weeks I can't see what you have in your example file - I'm on annual leave currently, and I don't have MS Office in my home computer.
Reply With Quote
  #8  
Old 03-13-2024, 01:23 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Extract specific text from a text string Help Windows 10 Extract specific text from a text string Help Office 2021
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

See attached
Attached Files
File Type: xlsx Extract Text from string updated.xlsx (11.3 KB, 6 views)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #9  
Old 03-19-2024, 09:57 AM
Haha88 Haha88 is offline Extract specific text from a text string Help Windows 8 Extract specific text from a text string Help Office 2010 32bit
Advanced Beginner
Extract specific text from a text string Help
 
Join Date: Mar 2015
Posts: 75
Haha88 is on a distinguished road
Default

Quote:
Originally Posted by Pecoflyer View Post
See attached
Thank you so much for your help. The formula works like a charm.

Have a wonderful day.
Reply With Quote
  #10  
Old 03-20-2024, 01:44 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Extract specific text from a text string Help Windows 10 Extract specific text from a text string Help Office 2021
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

You're welcome


For members unwilling or unable to open the sheet this is the formula I suggested
(replace ; and \ by a comma if needed)

Code:
=SUBSTITUTE(TRIM(LEFT(E5;MIN(FIND({0\1\2\3\4\5\6\7\8\9};E5&"0123456789")-1)));"Contractor ";"")
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract specific text from a text string Haha88 Excel 12 11-01-2022 10:47 AM
Extract Text from a text string Haha88 Excel 3 05-19-2022 08:27 AM
Formula to Extract text from a text string Haha88 Excel 2 11-14-2017 01:32 AM
Extract specific text from a text string Help Extract text from a text string Haha88 Excel 8 02-13-2017 05:06 PM
Extract numbers from a text string aleale97 Excel 4 02-10-2011 10:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft