January 6, 200619 yr Thanks for all the help. This is a great forums. When I scan a part number it sometimes come up with 1Pxxxxxxxxx, the rest of characters real part number. The real part number can have 8 - 10 characters. How can I remove the first 2 characters (1P) if they exixt? Again Thanks!
January 6, 200619 yr Well you can use the left, right, position functions but maybe you should supply us with more information so that we can help you in greater detail. Is there always 2 characters in the beginning that you want to get rid of? If so is the second character always a Alpha-character? etc etc. The more detail the better.
January 6, 200619 yr Author Here's some examples: 1PP1234LPMM - will need to trim the starting 1P 1PM123456PMM9 - will need to trim the starting 1P M123456PMM9 - No need to do any trim P12345 - No need to do any trim Thanks
January 6, 200619 yr Ok... so how does one determine if something needs to be trimmed or not? You still have not answered my earlier questions. We would need the rule to determine if it needs to be trimmed or not, otherwise how can we know when to trim it or not? Does it need to be trimmed only when it starts with 1P ?
January 6, 200619 yr Should work... unless the character sequence "1P" occurs elsewhere in the string and truly belongs there.
January 6, 200619 yr It seems pretty clear that 1P should only be removed if it exists as the first two characters. In which case, Lee, your calc would also remove 1P if it exists later in the string. This should protect from that possibility ... If ( Left ( PartNumber ; 2 ) = "1P" ; Substitute ( PartNumber ; Left ( PartNumber ; 2 ) ; "" ) ; PartNumber ) LaRetta :wink2: Edited January 6, 200619 yr by Guest Corrected for vs. 7
January 6, 200619 yr Darn, I missed that it was for v7, I responded to his profile of v6. Yes, Ted, I'm aware of that too. so now, Thanh has a couple of choices. Lee
January 6, 200619 yr Darn is right, Lee. I saw version 6!! Change the commas to semi-colons for vs. 7. Update: I corrected the above calc Edited January 6, 200619 yr by Guest Added Update
January 6, 200619 yr I'm afraid your calc suffers from the same flaw as Lee's: If ( Left ( PartNumber ; 2 ) = "1P" ; Substitute ( PartNumber ; Left ( PartNumber ; 2 ) ; "" ) ; PartNumber ) If the test is true, the substitution part evaluates as: Substitute ( PartNumber ; "1P ; "" ) Suppose the PartNumber is entered as "1P55AA1P". Your result will be "55AA", instead of "55AA1P". Try: Case ( Left ( PartNumber ; 2 ) = "1P" ; Right ( PartNumber ; Length ( PartNumber ) - 2 ) ; PartNumber )
Create an account or sign in to comment