Hi, welcome to the forum

I did this with a helper column...
A
B
1
2059251 On order 2059251 1006668HD
2
Item code : 1006668HD Item code : 1006668HD
3
4
5
2059789 On order 2059789 1043628
6
2059867 On order 2059867 1043628
7
Item code : 1043628 Item code : 1043628
8
9
2059866 On order 2059866 1045841HD
10
Item code : 1045841HD Item code : 1045841HD


B1=IF(A1="","",IF(ISNUMBER(--LEFT(A1,1)),SUBSTITUTE(A1,"On order",MID(OFFSET(A1,MATCH("Item Code*",A1:A3,0)-1,0),13,99)),A1))

If needed, you can then copy/paste values the helper column back over he original data, then delete the helper

This will work if you have a max of 3 lines per item