如何创建用户定义的公式而不是键入长字符串(How to create a user defined formulas instead of typing out long strings)

编程入门 行业动态 更新时间:2024-10-28 03:29:17
如何创建用户定义的公式而不是键入长字符串(How to create a user defined formulas instead of typing out long strings)

我正在尝试将以下公式分配给用户定义的公式,这些公式通常会粘贴到单元格中。

=串连(文本(A2, “000000”), “ - ”,文本(A3, “000”))

我需要文本部分格式化,并在连字符前最多6位数的前导零和连字符后最多3位数。 我想将它分配给格式(Selection1,Selection2),其中选择1将是A2,选择2将是A3,例如,这样我就可以避免必须一直输出整个字符串。

I am trying to assign the following formulas that i would normally paste into a cell to a user defined formula.

=concatenate(text(A2,"000000"),"-",text(A3,"000"))

I need the text portion to format and get leading zeros up to 6 digits before the hyphen and up to 3 digits after the hyphen. I wanted to assign it to Format(Selection1, Selection2) where selection 1 would be A2 and selection 2 would be A3 for example so that I could avoid having to type out that entire string all the time.

最满意答案

Function blah(A, B) blah = Format(A, "000000") & "-" & Format(B, "000") End Function Function blah(A, B) blah = Format(A, "000000") & "-" & Format(B, "000") End Function

更多推荐

本文发布于:2023-08-05 01:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1426149.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   公式   而不是   定义   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!