First your explanation is contradictory according to your own rules :
A) « if the last item contains short letters like JAP or THI
then don't add any thing »
versus
B) « if the last item … IND and the adjacent cell is Indonesia … then the last item … will become INDO » …
Following rule A so rule B can't be applied ‼ So the elaboration should better be :
according to column C lookup in 'liss' sheet for the SHORT text like for India its SHORT text is IND
then if the last item in column B is different then replace it with the SHORT text - or if missing add it -
like if column B last item is IND and column C is Indonesia so according to 'liss' sheet replace IND with INDO.
Now that's clear and no more conflict as it is a single rule rather than your both !
So this revisited rule well works with your initial attachment.
But in your post #36 attachment a 'new country' appears : N/A ! I have no clue, maybe New Argentina, whatever …

So following the rules, in particular the POLAND sample in your initial attachment when the country does not exist in the 'liss' worksheet,
this is the result for PR-2023-00004 :
Q3.jpg
So is it the expected result ?

If not, what must it be, what is the mandatory missing rule ?
And you should better explain all the specific cases 'cause as a reminder
I will post a
one shot code so I won't modify it for what you forgot / misexplained …
Such poor initial post attachment not well reflecting your real data just leads to a waste of time,
maybe the reason why - with the foggy explanation - you did not receive any help during several days …
As on my side it was the case, your initial post looks like you did not ever well understand your need !
As always with your threads the difficulty is very not to write a code but to decypher your need, very time consuming,
certainly the main reason why the helpers here on their free time, often short, prefer to directly move to the next threads
in order to help several people well following the forum rules (whatever the Excel forum, it's the same)
rather than consuming all their free time for your thread and finally won't help …
Bookmarks