I have a cell (E1) with a string of text. I need to extract the batch number from the text string and put it in a seperate cell (D1) The problem I am having is the batch number ie either 7 or 8 characters in lentgh. Here is a sample of the alue in E1:
BatchID - BI98C01D XMLExtraction - FATAL error occurred while processing
BatchID - BI352C3 XMLExtraction - FATAL error occurred while processing
Here is my Code to pull the batch number out:
This one works when the batch number is 8 positions but not when it is 7 postions. It adda a space at the end
This one works when the batch number is 7 positions but not when it is 8 postions. It truncated the last position of the batch number,
I have normalized the data to ensure there were no leading spaces
This all leads to my COUNTIF to be off when counting the number of 7and 8 position batch numbers.
Any help in getting these formulas fixed would be greatly appreciated.
Terry
BatchID - BI98C01D XMLExtraction - FATAL error occurred while processing
BatchID - BI352C3 XMLExtraction - FATAL error occurred while processing
Here is my Code to pull the batch number out:
This one works when the batch number is 8 positions but not when it is 7 postions. It adda a space at the end
Code:
=IF(E150="","",MID(E150,SEARCH("-",E150)+2,SEARCH(" ",E150)-0))
This one works when the batch number is 7 positions but not when it is 8 postions. It truncated the last position of the batch number,
Code:
=IF(E179="","",MID(E179,SEARCH("-",E179)+2,SEARCH(" ",E179)-1))
I have normalized the data to ensure there were no leading spaces
This all leads to my COUNTIF to be off when counting the number of 7and 8 position batch numbers.
Code:
=CONCATENATE(COUNTIF($D$7:$D300,"????????")," - Batches with 8 character batch id: ")
=CONCATENATE(COUNTIF($D$7:$D300,"???????")," - Batches with 7 character batch id: ")
Any help in getting these formulas fixed would be greatly appreciated.
Terry