Тёмный

Extract Text From Nth Occurrence of a Space in a Cell 

Computergaga
Подписаться 107 тыс.
Просмотров 31 тыс.
50% 1

Extract text from the nth occurrence of a space in a cell.
This video looks at how to extract some text from another cell by looking for the 3rd occurrence of a space in the cell. The characters we want to extract occur after the 3rd space within the cell.
By using the MID function along with FIND and SUBSTITUTE we can achieve this complex operation. Once written this will work for all the records in a list.
Find more great free tutorials at;
www.computerga...
** Online Excel Courses **
The Ultimate Excel Course - Learn Everything ► bit.ly/Ultimat...
Excel VBA for Beginners ► bit.ly/37XSKfZ
Advanced Excel Tricks ► bit.ly/3CGCm3M
Excel Formulas Made Easy ► bit.ly/2ujtOAN
Creating Sports League Tables and Tournaments in Excel ► bit.ly/2Siivkm
Connect with us!
LinkedIn ► / 18737946
Instagram ► / computergaga1
Twitter ► / computergaga1

Хобби

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 69   
@alexstrassel742
@alexstrassel742 3 года назад
What about if the "3" isn't fixed.... but it could be; 3,5,12,1,4 spaces from the left?
@aguerojg
@aguerojg 9 лет назад
Excellent tutorial, Computergaga, the explanation can't be clearer. Thanks for sharing your knowledge!!
@soumyamohapatra646
@soumyamohapatra646 4 года назад
Thank you!
@Computergaga
@Computergaga 4 года назад
My pleasure Soumya.
@jumbyto
@jumbyto 2 года назад
Good job, but maybe you need a certain text like 3542 or 5 .... there you go as an assist to this problem : =SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A2)))/10)
@maykwan5538
@maykwan5538 4 года назад
Super!! Thanks
@Computergaga
@Computergaga 4 года назад
Welcome 😊
@jay55patel
@jay55patel 4 года назад
thank you
@Computergaga
@Computergaga 4 года назад
You're welcome Yay.
@mohanpal13555
@mohanpal13555 5 лет назад
Awesome vedio sir
@Computergaga
@Computergaga 5 лет назад
Thank you very much Mohan.
@soumyamohapatra646
@soumyamohapatra646 4 года назад
One question here we are hard coding the number of characters to be extracted to 2. If my length is varying, how to make it dynamic. Like i have numbers like 38,532,6554. I want the code to extract these.
@Computergaga
@Computergaga 4 года назад
We would need to also find the end of the characters to extract, and subtract the starting position to leave us with the number of characters. This would be used in the place of the 2. I have this video on extracting text between two characters which may also help - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Yf-aqzuuQzE.html
@veritymorris2079
@veritymorris2079 5 лет назад
Super helpful! Very easy to follow and understand - thank you
@Computergaga
@Computergaga 5 лет назад
Thank you Verity.
@50majeedkhan
@50majeedkhan 3 года назад
If number start with on letter also please
@mattmcmhn
@mattmcmhn 5 лет назад
This is good, but really misses the power of doing a substitute to count spaces. In this example there's 0 reason to not just copy the column, text to columns, and grab the 4th column since the formula completely relies on the data you want always being after the 4th space from the beginning. Where using substitute is really useful is in text strings where there are a varying number of spaces, but your data that you want to pull out is at the beginning or end of the string and you want to disregard the middle. An example would be a string with say a customer number, then name and address, then maybe a date and amount at the end. You want the customer number, date, and amount, but the name/address information obviously has a varying number of spaces. You know the date and amount are always between the last two spaces from the end, so this formula would be modified to count the number of spaces in the cell and then return the information between the second and first space from the end, and the last space from the end.
@Computergaga
@Computergaga 5 лет назад
Thank you Matt. SUBSTITUTE is such a useful function, there are many instances of its benefits. When compared to using Text to Columns instead, the key difference is that the formula automates the solution. Someone would need to manually perform Text to Columns each time. So it all depends on the regularity of the task.
@harshadvegda8097
@harshadvegda8097 4 года назад
What a great solution suggested. Thanks a lot. I had been working hard to solve such issues. In spite of my many years of experience, mathematical skills I could never find a right solution. I have developed formulas but they are very clumsy and involving so many columns. Sir, Thanks a lot as it is solved in just one statement. Excellent Tutorial
@Computergaga
@Computergaga 4 года назад
Thank you very much Harshad.
@kameshsharma5164
@kameshsharma5164 3 года назад
Sir, I request you to please make a formula in which I can extract two or three words from the middle of the line of a cell in Excel. I have made different formulas for both, but I am not able to form a formula by mixing them both. I am sharing both those formulas with you. You are requested to mix these two and make a formula so that I can extract two or three or four words from a line in a cell. Please Please (To extract one word from mid of line) =Trim(MID(SUBSTITUTE(B6," ",REPT(" ",LEN(B6))),(C6-1)*LEN(B6)+1,LEN(B6))) (To extract 2 or 3 word from the starting of the line) =TRIM(LEFT(B1,FIND("~",SUBSTITUTE(B1," ","~",A1)&"~")))
@vandalo7494
@vandalo7494 8 лет назад
Nice approach Computergaga. Before assist your video until the end, I tried my own approach where I should extract all the text before the numbers. So this was the formula I came up. {=left(A1,small(if(--(mid(A1,row(indirect("1:"&len(A1))),1)=" ")*row(indirect("1:"&len(A1)))=0," ",row(indirect("1:"&len(A1)))),3)-1)} BTW nice accent. I had no problem to understand you.
@robertbarker2023
@robertbarker2023 3 года назад
Howdo you extract first, middle, last names and suffix such as Jr. into separate columns. Not everyone has a suffix nor does everyone have a middle name?
@kinkineki
@kinkineki 3 года назад
This is great thanks for replying so quickly. Do you know how to do exactly this but with a Regextract formula? This formula doesn't translate well to Google data studio unfortunately
@ankan123jyoti3
@ankan123jyoti3 9 лет назад
Thanks.. Your video really helped me a lot. But what if the length of the extracted data is variable. We cannot put 2 in that case. Please help!!
@Computergaga
@Computergaga 9 лет назад
Ankan123 Jyoti You will need to locate the end of the string using Find and Substitute again maybe like this vid. Then subtract the position of first character from position of last character.
@ankan123jyoti3
@ankan123jyoti3 9 лет назад
Computergaga Thanks.. Bcoz of your tutorial I figured to manage my excel.. Highly appreciated.
@soumyamohapatra646
@soumyamohapatra646 4 года назад
@@ankan123jyoti3 Can you please help. I have the same query.
@monikakrausuk
@monikakrausuk 3 года назад
What if the number can be 1 digit or 3 digits and more instead of only 2? How would that work?
@Computergaga
@Computergaga 3 года назад
Hi Monika, the following will work. On th question where we entered 2, we use the FIND and SUBSTITUTE again to find the difference between the fourth occurrence of a space and the third occurrence of a space. =MID(A1,FIND("*",SUBSTITUTE(A1," ","*",3)),FIND("?",SUBSTITUTE(A1," ","?",4))-FIND("*",SUBSTITUTE(A1," ","*",3)))
@jumbyto
@jumbyto 2 года назад
@@Computergaga extract number from a text : * replace A2 with whatever destination of extraction you need =SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A2)))/10) Take care
@bayareanonsense506
@bayareanonsense506 6 лет назад
came for the lesson stayed for the accent. this is brilliant and helpful; you approached it with the right attitude.
@Computergaga
@Computergaga 6 лет назад
Thanks Erin.
@bayareanonsense506
@bayareanonsense506 6 лет назад
i do have a question i'm trying to set the function to extract text from between two characters for ex: blah-blah-blah-blah_wordtoextract-moretext. i used your function =MID(A2,FIND("*",SUBSTITUTE(A2,"_"," * ",1)),5) but the names i need to extract go beyond 5 characters. how do i set the formula to only look for text between the "_" and "-"?
@Computergaga
@Computergaga 6 лет назад
The formula below works for your example Erin. =LEFT(RIGHT(A2,LEN(A2)-FIND("_",A2)),FIND("-",RIGHT(A2,LEN(A2)-FIND("_",A2)))-1) It uses the RIGHT function to extract everything after the _ and then the LEFT function from that result to extract everything before the -.
@jtr12265
@jtr12265 9 лет назад
Oh, thanks Computergaga. Thank God, I found this video. I was looking for this for several days. The trick you shared with us is really helpful. Keep up the sharing!
@oliverdosramos8255
@oliverdosramos8255 4 года назад
Love it thanks!
@Computergaga
@Computergaga 4 года назад
You're very welcome. Thank you Oliver.
@radhakrishnanradhakrishnan2122
@radhakrishnanradhakrishnan2122 4 года назад
Sir, I have need first space & second space between text Example: GGG hhh ffff-hhh GGG hhhh
@martinsger
@martinsger 3 года назад
IN TIME OF PANDEMY, ITS THE FORMULA: =LEFT(A6,FIND(" ",A6)-1)&" "&MID(A6;FIND(" ",A6)+1,(FIND(" ",A6;FIND(" ",A6)+1))-FIND(" ",A6)-1) .
@arq.gabrielamartinez7146
@arq.gabrielamartinez7146 3 года назад
This video was awesome. Normally these tutorials bore me a bit... This one was so entertaining, haha. Love your energy!
@Computergaga
@Computergaga 3 года назад
Thank you very much, Gabriela.
@babiechad
@babiechad Год назад
a 7-year-old video I stumbled upon which helped me immensely! thank you!
@Computergaga
@Computergaga Год назад
Excellent! You're very welcome.
@sandivant
@sandivant 10 месяцев назад
THANK YOU! This is the ONLY video that has helped!
@Computergaga
@Computergaga 9 месяцев назад
You're welcome! Glad I could help.
@imranali-iy5wk
@imranali-iy5wk 6 лет назад
sir I have some problem in excel I have a hudge data of names that is one lakh plus I want to found those names which have no space
@Computergaga
@Computergaga 6 лет назад
I don't completely understand the question Imran. You have a list of names with and without spaces and a lakh in the same column. And you want the names without spaces? Sounds complex. Depending on the names involved, possibly almost impossible to automate as names are so random in length and structure.
@kameshsharma5164
@kameshsharma5164 3 года назад
Thanks sir, very helpful video. But I want to know whether we can extract more than one word. You have taught to extract one word from the middle of a line, in this video, but I want to get more than one word from a line.
@Computergaga
@Computergaga 3 года назад
Sure. You would need a way to recognise the end of the words. Either a delimiter or a number of words.
@kameshsharma5164
@kameshsharma5164 3 года назад
@@Computergaga Sir, I request you to please make a formula in which I can extract two or three words from the middle of the line of a cell in Excel. I have made different formulas for both, but I am not able to form a formula by mixing them both. I am sharing both those formulas with you. You are requested to mix these two and make a formula so that I can extract two or three or four words from a line in a cell. Please Please (To extract one word from mid of line) =Trim(MID(SUBSTITUTE(B6," ",REPT(" ",LEN(B6))),(C6-1)*LEN(B6)+1,LEN(B6))) (To extract 2 or 3 word from the starting of the line) =TRIM(LEFT(B1,FIND("~",SUBSTITUTE(B1," ","~",A1)&"~")))
@janlaubscher914
@janlaubscher914 5 лет назад
Hi Computergaga, i am in need of some help, on this topic. the video gives a perfect explanation of how to get the information that i need from the string of text. but my string of text gets generated online, and will be refreshed daily where the numbers that i need extracted from the text will also change, in the way that the numbers get larger daily. is there a way to setup the formula so that it will automatically extract the number no matter how many characters it is?
@Computergaga
@Computergaga 5 лет назад
Absolutely. You could use Power Query to import data from the web if you need a way, and this is refreshable. And then wit the formula you already have, possibly combined with something like this - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Yf-aqzuuQzE.html to locate the end of the numbers too. Then the length of numbers will not affect things.
@janlaubscher914
@janlaubscher914 5 лет назад
@@Computergaga , thanks, i managed to find a way, had to use multiple formulas to get the results that i wanted, but it works now the way i want it to. i have been having a problem though with the data web query. as of late it keeps telling me that "the site reports that the request is not valid". any ideas on how to solve this issue as the hyperlink i am using does work in my browser but i cant get it to work in excel, even though it did at the beginning. all the formulas i put together to extract information from the text from the link is useless now as the link wont auto refresh to update the information i need. i would really appreciate any help i can get. have searched the web for days now and cant get a clear answer as to why its doing this, what is the cause or how to fix it so that the links work again. thanks in advance for any help or advice you can provide me with.
@GilCuriously
@GilCuriously 4 года назад
Hello. Instead of extracting, what function would you use to delete those two characters?
@Computergaga
@Computergaga 4 года назад
The SUBSTITUTE function would be used to remove characters using a formula. If you want to remove them from the current cells, then use the Find and Replace tool.
@martinsger
@martinsger 3 года назад
IN TIME OF PANDEMY, SEE RESOLUTION: =SUBSTITUTE(A13,MID(A13,FIND("*",SUBSTITUTE(A13;" ","*",3))+1,2),"")
@khuntiaachyutanan7316
@khuntiaachyutanan7316 4 года назад
if i will try extract 38 Orange from the sentence red yellow blue 38 Orange , how is formula
@Computergaga
@Computergaga 4 года назад
I would use Power Query. It has an option to split column from a number.
@khuntiaachyutanan7316
@khuntiaachyutanan7316 4 года назад
Great sir, but it is out of excel formula
@martinsger
@martinsger 3 года назад
IN TIME OF PANDEMY, SEE RESOLUTION: =SUBSTITUTE(A13,MID(A13,FIND("*",SUBSTITUTE(A13;" ","*",3))+1,2),""), THE 38 WILL DELETED
@pipo441
@pipo441 Год назад
Beautifull
@Computergaga
@Computergaga Год назад
😊👍
Далее
Excel Magic Trick 559: Extract Nth Word In Text String
13:18
Провал со стеклянным хлебом…
00:41
Living life on the edge 😳 #wrc
00:17
Просмотров 2,1 млн
Extract Text Between Two Characters in Excel
6:30
Просмотров 113 тыс.
How to Extract Part of Text String from an Excel Cell
16:43
Extracting Text between Characters [Two Examples]
8:19
ТАМОЖНЯ БЕЛАРУСИ
0:19
Просмотров 6 млн
ЧТО ЕМУ СДЕЛАЛИ КОМАРЫ😳
0:28
Просмотров 3,2 млн