Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

intelligent split string in excel formula - full words

How to split string that the words isn't split and result string is max 30 chars ?

input cell = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt'

output cell = 'Lorem ipsum dolor sit amet'

I need only formula, not VBA.

question from:https://stackoverflow.com/questions/65894264/intelligent-split-string-in-excel-formula-full-words

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Simpler array formula:

=SUBSTITUTE(TRIM(LEFT(A1,MAX(IF(MID(A1,ROW($1:$30),1)=" ",ROW($1:$30))))),",","")

Array formula after editing is confirmed by pressing ctrl + shift + enter

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...