[英]How to make an excel (365) function that recognizes different words in the same cell and changes them individually
What im working with我在做什么
I have a list of product names, but unfortunately they are written in uppercase I now want to make only the first letter uppercase and the rest lowercase but I also want all words with 3 or less symbols to stay uppercase我有一个产品名称列表,但不幸的是它们是用大写字母写的我现在只想让第一个字母大写和 rest 小写但我也希望所有带有 3 个或更少符号的单词保持大写
im trying if functions but nothing is really working我正在尝试功能,但没有任何效果
i use the german excel version but i would be happy if someone has any idea on how to do it im trying different functions for hours but nothing is working我使用德语 excel 版本,但如果有人知道如何做我会很高兴我尝试了几个小时不同的功能但没有任何效果
=IF(LENGTH(C6)<=3,UPPER(C6),UPPER(LEFT(C6,1))&LOWER(RIGHT(C6,LENGTH(C6)-1)))
but its a #NAME error excel does not recognize the first and the last bracket但它的#NAME 错误 excel 无法识别第一个和最后一个括号
This is hard: Let me explain:这很难:让我解释一下:
With the above in mind I think it's safe to say that we can try to accomplish something that you want as best as we can.考虑到上述情况,我认为可以肯定地说,我们可以尽我们所能尝试完成您想要的事情。 Therefor I'd suggest
因此我建议
For example:例如:
Formula in B1
: B1
中的公式:
=MAP(A1:A5,LAMBDA(v,LET(x,TEXTSPLIT(v,{"-","/"," ","."},,1),y,TEXTSPLIT(v,x,,1),z,TEXTJOIN(y,,MAP(x,LAMBDA(w,IF(SUM(--(w={"zu","ein","für","aus"})),LOWER(w),IF((LEN(w)<4)+SUM(IFERROR(FIND(SEQUENCE(10,,0),w),)),UPPER(w),LOWER(w)))))),UPPER(LEFT(z))&MID(z,2,LEN(v)))))
You can see how difficult it is to capture each and every possibility;你可以看到捕捉每一种可能性是多么困难;
Point is, this is not just hard, it's extremely hard if not impossible to do on the type of data you are currently working with, Even if one is proficient with writing a regular expression (chuck in all (non-available to Excel) tokens, quantifiers and methods if you like).重点是,这不仅困难,而且即使不是不可能,也很难对您当前使用的数据类型进行操作,即使一个人精通编写正则表达式(查入所有(不可用于 Excel)标记,量词和方法,如果你喜欢的话)。 I'd doubt all edge-case could be covered.
我怀疑是否可以涵盖所有边缘情况。
Because you are dealing with any number of words in a cell you'll need to get crafty with this one.因为您要处理一个单元格中的任意数量的单词,所以您需要巧妙地处理这个单词。 Thankfully there is
TEXTSPLIT()
and TEXTJOIN()
that can make short work of splitting the text into words, where we can then test the length, change the capitalization, and then join them back together all in one formula:值得庆幸的是,有
TEXTSPLIT()
和TEXTJOIN()
可以简化将文本拆分为单词的工作,然后我们可以在其中测试长度,更改大小写,然后将它们重新组合到一个公式中:
=TEXTJOIN(" ", TRUE, IF(LEN(TEXTSPLIT(C6," "))<=3,UPPER(TEXTSPLIT(C6," ")),PROPER(TEXTSPLIT(C6," "))))
Also used PROPER()
formula as well, which only capitalizes the first character of a word.还使用了
PROPER()
公式,它只将单词的第一个字符大写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.