从一组数字中列出增加数字的列表

发布于 2025-02-04 10:18:12 字数 739 浏览 3 评论 0原文

我一直在尝试编写一个公式来创建一组数字的列表。我试图使用“ IF”功能执行此操作,但失败了很多次。

规则是通过向每个数字添加-2,-1和+1,+2来创建一组数字,以使原始列表的大小成倍增长。

因此,如果原始列表包括(x,y),则计算出的新列表将包括(X-2,X-1,X,X,X+1,X+2,Y-2,Y-2,Y-1,Y) ,y+1,y+2)。

原始数字都是正数,预计计算的列表为均为所有正,不应包括重复数字都不。

例如,

在A1,B1,C1,D1等列中

= 1、2、4、5、9、10、22、25(在这种情况下,总共有8个数字

)和+1,+2到我们得到的每个数字;

    Calculated values =   -1, 0, 1, 2, 3,  0, 1, 2, 3, 4,  2,3,4,5,6,
 3,4,5,6,7, 7,8,9,10,11, 8,9,10,11,12, 20,21,22,23,24, 23,24,25,26,27 
    
    Final Calculated List should be : 1,2,3,4,5,6,7,8,9,10,11,12,20,21,22,23,24,25,26,27 

(省略了所有重复和负数,省略0)

我意识到如果功能,我无法做到这一点,我可以得到帮助如何解决这个问题吗?请。 提前致谢。

I've been trying to write a formula to create a list from a given set of numbers. I tried to do this with "if" function but failed many times.

The rule is to create a set of numbers by adding -2, -1 and +1, +2 to each number so that growing the size of the original list exponentially.

so if the original list includes is (x,y), the calculated new list would include (x-2,x-1,x,x+1,x+2, y-2,y-1, y, y+1, y+2).

Original numbers are all positive, and the calculated list is expected to be all positive, and should not include zero and repetitive numbers neither.

E.g,

in columns A1,B1,C1,D1, etc

List = 1, 2, 4, 5, 9, 10, 22, 25 (in this case there is a total of 8 numbers)

when you add -2, -1 and +1, +2 to each number we get ;

    Calculated values =   -1, 0, 1, 2, 3,  0, 1, 2, 3, 4,  2,3,4,5,6,
 3,4,5,6,7, 7,8,9,10,11, 8,9,10,11,12, 20,21,22,23,24, 23,24,25,26,27 
    
    Final Calculated List should be : 1,2,3,4,5,6,7,8,9,10,11,12,20,21,22,23,24,25,26,27 

( all repetitive and negative numbers, 0's are omitted)

I realized that I can't do this with if function, can I get help how to solve this problem? please.
thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉 2025-02-11 10:18:12

尝试:

=TEXTJOIN(", ", 1, INDEX(QUERY(SORT(UNIQUE(FLATTEN(
 SPLIT(A1, ",")+{-2; -1; 0; 1; 2}))), "where Col1>0", )))

Try:

=TEXTJOIN(", ", 1, INDEX(QUERY(SORT(UNIQUE(FLATTEN(
 SPLIT(A1, ",")+{-2; -1; 0; 1; 2}))), "where Col1>0", )))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文