grumbachr Posted October 7, 2009 Posted October 7, 2009 I have 10K+ records with a fields holding values similar to these; AAA_02_1234 AAA_102_3456 AAA_5102_9876 AAA_7_HAMBERGER ZZZ_22_12346 ZZZ_442_12346 PCDD_18_05 The majority of them follow a certain structure but the only thing absolute about all of them are the "_" (underscores). I'm trying to extract just the numbers between the underscores but I'm not having much luck. I'm trying two work with this Let function and was hoping for a little help. Right now it works to remove the first set of letter and the first underscore. I can't seem to get it to remove the last string and underscore. Let ( [ len = Length ( Lab_No ) ; pos = Position (Lab_No ; "_" ; 1 ;1) ; pos2 = Position (Lab_No ; "_" ; 1 ;2) ; pos2len = Length (Lab_No) - pos2 ] ; Right ( Lab_No ; len - pos ) ) I added pos2len but I'm not using it and I'm not sure I even need it. TIA.
comment Posted October 7, 2009 Posted October 7, 2009 Try: Let ( [ start = Position ( Lab_No ; "_" ; 1 ; 1 ) + 1 ; end = Position ( Lab_No ; "_" ; 1 ; 2 ) ] ; Middle ( Lab_No ; start ; end - start ) )
Lee Smith Posted October 7, 2009 Posted October 7, 2009 why not just MiddleWords ( Lab_No ; 2 ; 1 ) Lee
grumbachr Posted October 7, 2009 Author Posted October 7, 2009 Thank you both very much. Each worked but I'll have to say after looking over the results of each calc the first solution with the Let, start end... discovered a few errors in the original Lab_No, which will help improve the quality of my data.
Recommended Posts
This topic is 5584 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now