Hoppa till huvudinnehåll

Hur drar eller extraherar du tecken från höger till vänster i en cell tills ett utrymme nås i Excel?

Den här artikeln kommer att prata om att dra eller extrahera tecken från höger i en cell tills ett utrymme nås för att få följande resultat i Excel-kalkylblad. En användbar formel i den här artikeln kan lösa detta jobb snabbt och enkelt.

Dra eller extrahera tecken från höger i en cell tills ett mellanslag nås med formeln


Dra eller extrahera tecken från höger i en cell tills ett mellanslag nås med formeln

Här är en enkel formel som kan hjälpa dig att extrahera tecknen från rätt till cell tills ett mellanslag uppfylls, gör så här:

Ange denna formel: = TRIM (HÖGER (SUBSTITUT (A2, "", REPT ("", 255)), 255)) in i en tom cell där du vill få resultatet och dra sedan påfyllningshandtaget ner till celler som du vill fylla denna formel, och alla tecken från höger i celler när du möter det första utrymmet extraheras på en gång, se skärmdump:

Bästa kontorsproduktivitetsverktyg

🤖 Kutools AI Aide: Revolutionera dataanalys baserat på: Intelligent utförande   |  Generera kod  |  Skapa anpassade formler  |  Analysera data och generera diagram  |  Anropa Kutools funktioner.
Populära funktioner: Hitta, markera eller identifiera dubbletter   |  Ta bort tomma rader   |  Kombinera kolumner eller celler utan att förlora data   |   Rund utan formel ...
Superuppslag: Flera kriterier VLookup    VLookup med flera värden  |   VSök över flera ark   |   Fuzzy Lookup ....
Avancerad rullgardinslista: Skapa snabbt en rullgardinslista   |  Beroende rullgardinslista   |  Flervals-rullgardinslista ....
Kolumnhanterare: Lägg till ett specifikt antal kolumner  |  Flytta kolumner  |  Växla synlighetsstatus för dolda kolumner  |  Jämför intervall och kolumner ...
Utvalda funktioner: Rutnätsfokus   |  Designvy   |   Stor formelbar    Arbetsbok & Bladhanterare   |  Resursbibliotek (Automatisk text)   |  Datumväljare   |  Kombinera arbetsblad   |  Kryptera/Dekryptera celler    Skicka e-postmeddelanden efter lista   |  Superfilter   |   Specialfilter (filtrera fet/kursiv/genomstruken...) ...
Topp 15 verktygssatser12 text verktyg (lägga till text, Ta bort tecken, ...)   |   50+ Diagram Typer (Gantt Chart, ...)   |   40+ Praktiskt Formler (Beräkna ålder baserat på födelsedag, ...)   |   19 Införande verktyg (Infoga QR-kod, Infoga bild från sökväg, ...)   |   12 Konvertering verktyg (Siffror till ord, Valutaväxling, ...)   |   7 Slå ihop och dela verktyg (Avancerade kombinera rader, Dela celler, ...)   |   ... och mer

Uppgradera dina Excel-färdigheter med Kutools för Excel och upplev effektivitet som aldrig förr. Kutools för Excel erbjuder över 300 avancerade funktioner för att öka produktiviteten och spara tid.  Klicka här för att få den funktion du behöver mest...

Beskrivning


Fliken Office ger ett flikgränssnitt till Office och gör ditt arbete mycket enklare

  • Aktivera flikredigering och läsning i Word, Excel, PowerPoint, Publisher, Access, Visio och Project.
  • Öppna och skapa flera dokument i nya flikar i samma fönster, snarare än i nya fönster.
  • Ökar din produktivitet med 50 % och minskar hundratals musklick för dig varje dag!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This is a nice piece of formula,
I took liberty to change it and it worked for me.

Considering your data between two spaces is not more than 20 characters and you need data between spaces try this.

Original Formula for last space to end
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",255)),255))


Between 2nd last space and last space
=TRIM(LEFT(RIGHT(SUBSTITUTE(C1," ",REPT(" ",25)),50),25))


Between 3rd last space and 2nd last space

=TRIM(LEFT(RIGHT(SUBSTITUTE(C1," ",REPT(" ",25)),50),25))
This comment was minimized by the moderator on the site
si, solo tienes que cambiar el numero en negrella a 2 de la formula "=EXTRAE(A5;ENCONTRAR("@";SUSTITUIR(A5;" ";"@";LARGO(A5)-LARGO(SUSTITUIR(A5;" ";""))-1))+1;100)"
This comment was minimized by the moderator on the site
Hi, thanks so much for the help! Is there any way to do the same thing, but to pull out text from right to left until the THIRD space? It would save my life!!!!
This comment was minimized by the moderator on the site
Hello, santos
To extract the text from right to left until the THIRD space, please apply the below formula:
=IF((LEN(A1)-LEN(SUBSTITUTE(A1," ","")))<3, A1, RIGHT(A1,LEN(A1)-FIND("/", SUBSTITUTE(A1," ","/", (LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-2)))))


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
I am using a similar formula =TRIM(RIGHT(SUBSTITUTE(F7," ",REPT(" ",255)),255)) which is copying the word to G7, however I would like it to remove the word from F7. Are you able to assist me with what I need to adjust in my formula?
This comment was minimized by the moderator on the site
This is a great formula. I would love to understand the individual parts a bit better. Could someone provide a bit of a summary as to what each part is doing?
TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",255)),255))
This comment was minimized by the moderator on the site
Explanation of TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",255)),255))

TLDR: pad the space before the last character(s) on the right with 255 spaces, extract 255 characters from the right, then trim the space characters, leaving the desired non-text characters.

Long explanation:
1. REPT (Repeat) is adding 255 space characters. WHY? These added spaces will be inserted by SUBSTITUE.
2. SUBSTITUTE is replacing each space characters with 255 spaces (provided by REPT). WHY? This causes a cell to contain the desired characters on the right, plus 255 space characters to the left of the desired cell characters; this will be exploited by the RIGHT extraction function.
3. RIGHT is extracting the first 255 characters from the right. WHY? This extracts the desired characters on the right plus the added space characters (up to 255 characters) inserted by SUBSTITUTE.
4. TRIM is removing all space characters. WHY? This leaves only the desired characters on the right.


Caveat: This formula only works so long as the desired right text characters are <=255 characters. If the desired right text characters are >256, then the RIGHT function will miss the characters over 255.
This comment was minimized by the moderator on the site
Hi,
I had to put a Trim(A2) into mine as I had trailing blanks - otherwise works great.
This comment was minimized by the moderator on the site
Is there a way to extract and the result be read as a number? I am extracting the number part of an exported column that excel is reading as text. Thanks!
This comment was minimized by the moderator on the site
Hello, Russell,
If you need the result as number format, you should copy and paste the formula cells into other cells as values, and then convert the text format number to real number.
This comment was minimized by the moderator on the site
thanks a lot
This comment was minimized by the moderator on the site
This formula worked perfectly:
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",255)),255))

Is there any way to do the same thing, but to pullout text from right to left untill the SECOND space?
This comment was minimized by the moderator on the site
Hi, Paulius,
To extract the text from right to left until the second space, you should apply the below formula:
=MID(A2,FIND("@",SUBSTITUTE(A2," ","@",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1))+1,100)

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Thank you!!!!!!!!!!
This comment was minimized by the moderator on the site
Thank You it worked perfectly
This comment was minimized by the moderator on the site
Thank you so much! Saved me a ton of time!
This comment was minimized by the moderator on the site
This is close to what I need help with so I'm hoping someone can help. I need to pull over 20 characters or until the next space. how can I modify the formulas above to do that?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations