I am still getting this #Error. The field of sample data is:
DLY (Header Field) Data below.
DM
DM, ECL, GAD, GSH, HAO, HED
HAO, HED
I need to pull only the first one, to pull the new:
DLY (Header Field) Data below.
DM
DM
HAO
I think the first line of your data explains at least part of your problem. The solutions proposed all assumed that there would be two or more items on each line, separated by ",". When the IIf Statement parses the data it cannot find a ",". As a result, the subsequent Instr() and Mid() statements are doomed to failure. The case where no "," is found must also be taken into consideration.
That's what the extended IIF statement I responded with is supposed to do, but it might not be formulated completely. I didn't test it.
Sorry, I never even saw your reply or I would have made reference. The extended IIf looks like it was exactly what I was referring to.
I am still getting this #Error. The field of sample data is:
DLY (Header Field) Data below.
DM
DM, ECL, GAD, GSH, HAO, HED
HAO, HED
I need to pull only the first one, to pull the new:
DLY (Header Field) Data below.
DM
DM
HAO