By: Lutfor Rahman Shimanto

In reply to John.

Hello JOHN

Thanks for sharing your query. You wanted to split strings within Excel cells that do not always have 3 words separated by commas. In contrast, there can be a string like one or at most three words like the following image. Besides, we must keep the cell empty if more than 3 words mean more than 2 commas exist.

I am delighted to inform you that I have developed two formulas. The first formula consists of the IF, LEN, SUBSTITUTE, TRIM, and MID functions. The other formula consists of the IF, LEN, SUBSTITUTE, TRANSPOSE, and FILTERXML functions.
OUTPUT OVERVIEW:

1. Using IF, LEN, SUBSTITUTE, TRIM, and MID functions
Follow these steps:
Step 1: Select cell C5, insert the given formula and drag the Fill Handle icon to E5.

=IF(LEN($B5)-LEN(SUBSTITUTE($B5,”,”,””))>2,””,TRIM(MID(SUBSTITUTE($B5,”,”,REPT(” “,LEN($B5))),(C$4-1)*LEN($B5)+1,LEN($B5))))

Step 2: Select range C5:E5 and drag the Fill Handle icon to cell E10.

2. Using FILTERXML, TRANSPOSE, IF, LEN, and SUBSTITUTE functions

I am attaching the solution workbook for better understanding. I hope these ideas will help you to reach your goal. Good luck.

DOWNLOAD WORKBOOK

Regards
Lutfor Rahman Shimanto
ExcelDemy