Jump to content

This topic is 5709 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

Try:


Let ( [

start = Position ( Lab_No ; "_" ; 1 ; 1 ) + 1 ;

end = Position ( Lab_No ; "_" ; 1 ; 2 ) 

] ;

Middle ( Lab_No ; start ; end - start )

)

Posted

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.

This topic is 5709 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.