LaRetta Posted December 27, 2007 Posted December 27, 2007 (edited) Purpose: Grab all of the field starting at the first number. Examples are: CSR2400882A (result should be 2400882A) 3266427 (result should be 3266427) CHSZzSTVa241CRMC (result should be 241CRMC) Here's what I currently have (result is text) Let ( [ num = Substitute ( text ; [ 0 ; "~" ] ; [ 1 ; "~" ] ; [ 2 ; "~" ] ;[ 3 ; "~" ] ; [ 4 ; "~" ] ; [ 5 ; "~" ] ; [ 6 ; "~" ] ; [ 7 ; "~" ] ; [ 8 ; "~" ] ; [ 9 ; "~" ] ) ; pos = Position ( num ; "~" ; 1 ; 1 ) ] ; Right ( text ; Length ( text ) - pos + 1 ) ) ... I know, I know ... but I couldn't figure out how to best approach it (obviously). I could also use Middle ( text ; pos ; Length ( text )) but can I eliminate the substitution portion to identify each number? That part is so long and ugly! Sometimes my brain can't find elegance if it slapped me on the forehead! UPDATE: I originally had the string in rows down the page but I thought it wouldn't look so twisted if it was all together. It still looks twisted. LaRetta Edited December 27, 2007 by Guest Added update
LaRetta Posted December 27, 2007 Author Posted December 27, 2007 (edited) Let ( [ num = Substitute ( text ; [ 0 ; 1 ] ; [ 1 ; 1 ] ; [ 2 ; 1 ] ;[ 3 ; 1 ] ; [ 4 ; 1 ] ; [ 5 ; 1 ] ; [ 6 ; 1 ] ; [ 7 ; 1 ] ; [ 8 ; 1 ] ; [ 9 ; 1 ] ) ; pos = Position ( num ; 1 ; 1 ; 1 ) ] ; Right ( text ; Length ( text ) - pos + 1 ) ) Okay, changing the tilde to a 1 makes it smaller but it STILL looks twisted. Please save me from myself ... I KNOW I should be able to combine those numbers and find the starting position of them in one whack (and without a CF), right? Edited December 27, 2007 by Guest Changed sentence
Agnès Posted December 27, 2007 Posted December 27, 2007 Hello, Perhaps with "Filter" ? let ([ Num = Filter ( Text ; "0123456789" ) ; Pos = Position ( Text ; Left ( Num ; 1 ) ; 1 ; 1 ) ]; Middle ( Text ; Pos ; Length ( Text ) ) ) Agnes
LaRetta Posted December 27, 2007 Author Posted December 27, 2007 Of Course!! Thank you! It felt like the easy answer was on the tip of my tongue and I just couldn't find it! DOH! Thanks for putting me out of my misery, Agnes! :waytogo:
Recommended Posts
This topic is 6237 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