I am trying to write this instring script on a text field on Customer Name and having difficulties with the last name:
list of customer names:
Bob A George
John Thompson
Paul B Michael
I know the instr function is having difficulties because some of the names have middle letters. For the ones that have a Middle letter it is giving me the results with a space before it _George and the ones that don't have a middle letter it is cutting off the first couple letters. or giving me the last name with the middle letter. I have been trying it all different kind of ways and haven't figure it out
I have tried formulas such as:
Right([CN],InStr([CN]," ")-1)
I have also tried a mid function and haven't been successful. I almost think I need to do an if statement and do it one way if there is a letter and another if it is false, but haven't figured out to write it. Any help on this would be greatly appreciated.
The Left([CN],Instr([CN]," ")-1) works fine for the first name.
Thanks,
Matt
list of customer names:
Bob A George
John Thompson
Paul B Michael
I know the instr function is having difficulties because some of the names have middle letters. For the ones that have a Middle letter it is giving me the results with a space before it _George and the ones that don't have a middle letter it is cutting off the first couple letters. or giving me the last name with the middle letter. I have been trying it all different kind of ways and haven't figure it out
I have tried formulas such as:
Right([CN],InStr([CN]," ")-1)
I have also tried a mid function and haven't been successful. I almost think I need to do an if statement and do it one way if there is a letter and another if it is false, but haven't figured out to write it. Any help on this would be greatly appreciated.
The Left([CN],Instr([CN]," ")-1) works fine for the first name.
Thanks,
Matt
Comment