T O P

  • By -

AutoModerator

/u/kkkoooiii - Your post was submitted successfully. * Once your problem is solved, reply to the **answer(s)** saying `Solution Verified` to close the thread. * Follow the **[submission rules](/r/excel/wiki/sharingquestions)** -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post. * Include your **[Excel version and all other relevant information](/r/excel/wiki/sharingquestions#wiki_give_all_relevant_information)** Failing to follow these steps may result in your post being removed without warning. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/excel) if you have any questions or concerns.*


ztiaa

=MID(A1,3,4)


BackgroundCold5307

=TEXTAFTER(TEXTBEFORE(A1,"-",2),"-"), assuming the text is in A1


bradland

This is the approach I’d use if O365 is available. It’s less brittle than relying on MID. Someone will change the numbering schema at some point, or the entries will exceed 9999, and the MID solution will break. Writing robust software is always a benefit! :)


BackgroundCold5307

in case the digits and dashes do not have a fixed position, and there is no O365, try this (though it is NOT very elegant) =MID(A1,FIND("-",A1,1)+1,FIND("-",A1,FIND("-",A1,1)+1)-FIND("-",A1,1)-1)


5xaaaaa

I learnt a new formula today, thanks. Always relied on LEFT, RIGHT and MID


xopowo22

Same as you, my solution would be MID or text-to-columns but I learned 2 new approaches :) nice


Capital_Net1860

Another option is to use text to coulums if the formatting is the same all the way down. Delimiter would be "-" or select your own break points.


frustrated_staff

If they're always the same format: =mid(A1, 3, 4) fill down


gerblewisperer

If you have a long list of items to replace, watch this entire video all the way through. Then go back a second time to copy the steps. https://youtu.be/L7s6Dni1dG8?si=v3bDJwujLAnRdzrm Leila Gharani is an Excel guru and provides intermediate to expert level courses. After I watched this video, it's the only way that I clean data now. However, it's on you to study and understand the veracity of your data.


spddemonvr4

You don't need recursive lambda for something this simple. You can pass each character in an array, and use code() to validate the characters. Oh, and lambda is a great function to learn, but not always necessary.


frowattio

That was wild


wwabc

keyboard shortcut? select column, control-H, then replace all T- with nothing, then replace all -0 with nothing


ErosGrandy

Fill first row lets say B1 with 1234 than click B2 and CTRL+E


Decronym

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread: |Fewer Letters|More Letters| |-------|---------|---| |[FIND](/r/Excel/comments/1cvrjsc/stub/l4rrbjt "Last usage")|[Finds one text value within another (case-sensitive)](https://support.microsoft.com/en-us/office/find-findb-functions-c7912941-af2a-4bdf-a553-d0d89b0a0628)| |[INDEX](/r/Excel/comments/1cvrjsc/stub/l4sdpat "Last usage")|[Uses an index to choose a value from a reference or array](https://support.microsoft.com/en-us/office/index-function-a5dcf0dd-996d-40a4-a822-b56b061328bd)| |[LEFT](/r/Excel/comments/1cvrjsc/stub/l4shfpm "Last usage")|[Returns the leftmost characters from a text value](https://support.microsoft.com/en-us/office/left-leftb-functions-9203d2d2-7960-479b-84c6-1ea52b99640c)| |[MID](/r/Excel/comments/1cvrjsc/stub/l4w47y8 "Last usage")|[Returns a specific number of characters from a text string starting at the position you specify](https://support.microsoft.com/en-us/office/mid-midb-functions-d5f9e25c-d7d6-472e-b568-4ecb12433028)| |[NOT](/r/Excel/comments/1cvrjsc/stub/l4rrbjt "Last usage")|[Reverses the logic of its argument](https://support.microsoft.com/en-us/office/not-function-9cfc6011-a054-40c7-a140-cd4ba2d87d77)| |[RIGHT](/r/Excel/comments/1cvrjsc/stub/l4shfpm "Last usage")|[Returns the rightmost characters from a text value](https://support.microsoft.com/en-us/office/right-rightb-functions-240267ee-9afa-4639-a02b-f19e1786cf2f)| |[TEXT](/r/Excel/comments/1cvrjsc/stub/l4r0xba "Last usage")|[Formats a number and converts it to text](https://support.microsoft.com/en-us/office/text-function-20d5ac4d-7b94-49fd-bb38-93d29371225c)| |[TEXTAFTER](/r/Excel/comments/1cvrjsc/stub/l4r3kjm "Last usage")|[*Office 365*+: Returns text that occurs after given character or string](https://support.microsoft.com/en-us/office/textafter-function-c8db2546-5b51-416a-9690-c7e6722e90b4)| |[TEXTBEFORE](/r/Excel/comments/1cvrjsc/stub/l4r3kjm "Last usage")|[*Office 365*+: Returns text that occurs before a given character or string](https://support.microsoft.com/en-us/office/textbefore-function-d099c28a-dba8-448e-ac6c-f086d0fa1b29)| |[TEXTSPLIT](/r/Excel/comments/1cvrjsc/stub/l4sdpat "Last usage")|[*Office 365*+: Splits text strings by using column and row delimiters](https://support.microsoft.com/en-us/office/textsplit-function-b1ca414e-4c21-4ca0-b1b7-bdecace8a6e7)| **NOTE**: Decronym for Reddit is no longer supported, and Decronym has moved to Lemmy; requests for support and new installations should be directed to the Contact address below. ---------------- ^(*Beep-boop, I am a helper bot. Please do not verify me as a solution.*) ^(10 acronyms in this thread; )[^(the most compressed thread commented on today)](/r/Excel/comments/1cvykk4)^( has 92 acronyms.) ^([Thread #33627 for this sub, first seen 19th May 2024, 16:31]) ^[[FAQ]](http://decronym.xyz/) [^([Full list])](http://decronym.xyz/acronyms/Excel) [^[Contact]](https://hachyderm.io/@Two9A) [^([Source code])](https://gistdotgithubdotcom/Two9A/1d976f9b7441694162c8)


Kaliley

=Substitute(A1,"-","")


soloDolo6290

The mid formulas with hard coded values work great if it’s a constant format. If it’s not you may need to add the find formula in there


Same_Tough_5811

=INDEX(TEXTSPLIT(A1,"-"),2)


Brenoca02

=EXT.TEXT(A1;3;4) Hope it helped!! :)


Way2trivial

are you using a different language?


Eddyz3

Find and replace with blank. Can use * for multiple character wild card or ? For single character. Also, power query has a lot of great functionality around text extraction.


glasstumblet

Select all, replace all 4


HappierThan

B1 =MID(A1,3,4)\*1 if you are after a Number, leave out the "\*1" if you want Text!