找到三个数字之间的确切差异 [英] Finding Exact Difference between Three Numbers

查看:174
本文介绍了找到三个数字之间的确切差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个帐户并验证了我的电子邮件地址,但是当我尝试发布我的第一个疑问时就问了一个问题。它会显示一条消息,说明我的帖子无法提交。


我尝试发布以下内容:我正在尝试使用visual basic / excel的代码来计算三者的确切差异极大样本中的数字(三元组),在这个例子中我试图找出三个数字(x,y,z),其差异为11,换句话说,zy = 11,yx = 11.

有人可以给一些助手吗?


我尝试了以下代码:

I already created an account and verified my email adress, but when i tried to post my first doubt on ask a question. it displays a message that my post couldn''t be submitted.

I tried to post the following below: Im trying a code for visual basic/ excel to calculate the exact difference of three numbers (triples) in a extremely large sample, in this example im tryng to find out three numbers (x,y,z) whose difference is 11 , in other words z-y=11 , y-x=11.

Can someone give some aide???

I tried the following code:

展开 | 选择 | Wrap | 行号

推荐答案

Brunoff,


欢迎来到字节!


你能否详细解释一下你正在尝试做什么,因为它有点从你的帖子和你的代码中都不清楚你在追求的是什么。


我理解这一点:你正在寻找三个值,它们都有11个不同。你的描述暗示z> y> x?总是这样吗?如果y-z = 11怎么办?这种情况是否符合您的要求?


另外,如果您正在查看Excel中的三个连续单元格,或者您只是在寻找?任何三个满足的值,您都没有明确描述这些标准??


最后,这是一个有限大小的Excel电子表格吗?我要问的是,这是一个随机生成的电子表格,一天可以有12列和42行,下一行可以有17列和81行吗?或者它总是具有相同数量的行和列?这可能有助于为问题添加一些简单性,但无论哪种方式,最好知道这张表是如何为此目的而来的。


让我们了解更多细节,以及我们会看到我们可以对hepp做些什么!
Brunoff,

Welcome to Bytes!

Could you explain in just a bit more detail exactly what it is you are trying to do, as it is slightly unclear from both your post and your code what you are after.

I understand this: you are looking for three values which all have a difference of 11. Your description implies z > y > x?is this always the case? What if y-z = 11? Will this situation meet your requirement?

Also, you don?t describe explicitly if you are looking at three consecutive cells in Excel or if you are simply looking for ?any three values that meet these criteria??

Finally, is this a finitely sized Excel Spreadsheet? What I am asking is, is this a randomly generated spreadsheet that could have 12 columns and 42 rows one day and 17 columns and 81 rows the next? Or does it always have the same number of rows and columns? This might help add some simplicity to the problem, but either way, it would be good to know how this sheet comes to you for this purpose.

Let us know some more details, and we?ll see what we can do to hepp!


我对第一个问题的回复:你的描述暗示z> y> x?总是这样吗?我的回答是肯定的。澄清这一点的一个例子:在first1st.zip的第2行/第一行中,当你必须首先选择用于计算的数字区域时,在first1st.zip中有

和按CALC将产生以下结果:

(11,22,33)(22,33,44)(33,44,55)和(44, 55,66)。这三个结果是正确的(11,22,33)(22,33,44)(33,44,55),但这最后一个(44,55,66)它是错的,因为66号没有'' t属于原始输入数据 8 11 22 33 44 55


我对第二个问题的回复(如果yz = 11怎么办?这种情况会不会满足你的要求?要求?):因为对于每一行/每行我都试图找到任何3个数字显示为(x,y,z),满足它们之间的差异为11的条件。结果应仅视为一个计数为(11,22,33),因为在first1st.zip的第2行/第一行中有一个组合满足3之间的条件差异任何数字是11 33 -22 = 11,22-11 = 11所以这应该只计算一次。对于显示器,此表格形式(11,22,33)应优先于其他形式,如(33,22,11)或(22,11,33)。


我对第三个问题的回复(如果您在Excel中查看三个连续的单元格,或者您只是在寻找符合这些条件的三个值,那么您没有明确描述):

我试着找出显示为(,,)的任何三个数字,它们满足条件之间的差异,这3个数字中的任何一个都是11,每行/每行。


我对第四个问题的回答(这是一个有限大小的Excel电子表格吗?我要问的是,这是一个随机生成的电子表格,一天可以有12列和42行,下一行有17列和81行吗?或者总是这样具有相同数量的行和列?):


first1st.zip有6列和95行/行预定义输入数据,以便在a中显示我的问题简单的方法。

它总是一样的6列的数量,但预定义输入数据的行/行数将增加到10000行/行。


请你可以先运行上面的文件first1st.zip首先选择数字区域进行计算

和按CALC,它会显示我的内容一直试图解释。


我很感谢你的帮助
my reply for the first question: Your description implies z > y > x?is this always the case? my answer is yes. One example for clarifying this point: in the 2nd row/line of first1st.zip there is
8 11 22 33 44 55 in the first1st.zip when you must first SELECT THE AREA OF NUMBERS FOR CALCULATION
and the press CALC it will generate the following:
(11, 22, 33) (22, 33, 44) (33, 44, 55) and (44, 55, 66) . These three results are correct (11, 22, 33) (22, 33, 44) (33, 44, 55) but this last one here (44, 55, 66) it''s wrong because the number 66 doesn''t belong to the original input data 8 11 22 33 44 55

my reply for the second question (What if y-z = 11? Will this situation meet your requirement?): It will, because for each row/line im tryng to find any 3 numbers display as (x,y,z) that meet the condition that difference between them is 11. The result should be treated as only one count for (11, 22, 33), because in the 2nd row/line of first1st.zip there is one combination that meets the condition difference between 3 any numbers is 11 33 -22 =11 , 22-11=11 so this should be counted only once . For the display , this form form (11, 22, 33) should be prefereable than other forms such as (33,22,11) or (22,11,33).

my reply for the third question (you don?t describe explicitly if you are looking at three consecutive cells in Excel or if you are simply looking for ?any three values that meet these criteria??) :
I''m tryng to find out any three numbers displayed as ( , , ) that meets the condition difference between 3 any of these 3 numbers is 11 , for each row/line.

my reply for the forth question (is this a finitely sized Excel Spreadsheet? What I am asking is, is this a randomly generated spreadsheet that could have 12 columns and 42 rows one day and 17 columns and 81 rows the next? Or does it always have the same number of rows and columns? ) :

the first1st.zip has 6 columns and 95 rows/lines of predefined input data, in order to display my problem to you in a simple way.
It always have the same number of 6 columns, but the number rows/lines of predefined input data will increase to 10000 rows/lines.

Please, can you run the file first1st.zip above by first SELECTING THE AREA OF NUMBERS FOR CALCULATION
and the press CALC , it will show what i have been trying to explain.

I''m so grateful for your help


作为一般规则,我们不要下载zip文件,除非我们在此论坛上特别要求他们。这是因为我们很多人不能在工作中下载这些文件,更不用说出于一般安全原因了。


因此,特别是在这样的论坛上描述你的问题时,你需要更明确,并提供更多细节 - 不只是把你的项目扔到这里,并要求我们看看它。我不是很粗鲁,只是试图向第一时间解释网站政策。


所有这一切,在这一点上,我有点盲目地瞄准,但我会再问一些问题来帮助我,但也至少提供一些关于我将如何解决这个问题的指导。


首先,
AS a general rule, we don''t download zip files unless we specifically ask for them on this forum. This is because many of us can''t download these files at work, not to mention for general security reasons.

Thus, especially when describing your issue on a forum like this, you need to be more explicit and provide many more details--not just throw your project up here and ask us to take a look at it. I''m not being rude, just trying to explain site policies to a first-timer.

All that being said, at this point, I am somewhat aiming blindly, but I will ask a few more questions to help me out, but also provide at least a little bit of guidance as to "how I would approach this problem".

First,

8 11 22 33 44 55在first1st.zip中,当你必须首先选择用于计算的数字区域

并按下CALC它将生成以下:

(11,22,33)(22,33,44)(33,44,55)和(44,45,66)。
8 11 22 33 44 55 in the first1st.zip when you must first SELECT THE AREA OF NUMBERS FOR CALCULATION
and the press CALC it will generate the following:
(11, 22, 33) (22, 33, 44) (33, 44, 55) and (44, 55, 66).

IF 你有一组六个数字, IF 你知道你总会有一组六个数字,为​​什么你的代码产生66?这就是巨大的混乱因素所在.I 思想 你只是 比较 三个数字。您的结果意味着您正在计算一个值。那么,它是什么?


混淆因素2:

IF you have a set of six numbers, and IF you know that you will always have a set of six numbers, why does your code generate a 66? This is where the vast confusion factor sets in. I thought you were only comparing three numbers. Your result implies you are calculating a value. So, what is it?

Confusion factor 2:


结果应该只被视为一个计数(11 ,22,33),因为在first1st.zip的第2行/第一行中有一个组合满足3之间的条件差异任何数字是11 33 -22 = 11,22-11 = 11所以这应该只计算一次。对于显示器,此表格形式(11,22,33)应优于其他形式,如(33,22,11)或(22,11,33)。
The result should be treated as only one count for (11, 22, 33), because in the 2nd row/line of first1st.zip there is one combination that meets the condition difference between 3 any numbers is 11 33 -22 =11 , 22-11=11 so this should be counted only once . For the display , this form form (11, 22, 33) should be preferable than other forms such as (33,22,11) or (22,11,33).



说什么? 11,33,-22如何适合您的计划?第一对有22的差异,第二对有55的差异。所以,我要再问一遍,确切的是你用这个代码试图做什么?


最后,我解决这个问题的一般方法:

再次, IF 你有一组六个数字,并且 IF 您知道您将始终拥有一组六个数字,不需要选择数字区域。让代码做繁重的工作:


Option Explicit

Say what? How does 11, 33, -22 fit into your scheme? The first pair has a difference of 22, the second pair has a difference of 55. So, I have to ask again, EXACTLY what is it you are trying to do with this code?

Finally, my general approach to this problem:
Again, IF you have a set of six numbers, and IF you know that you will always have a set of six numbers, there should be no need to "select" the area of numbers. Let the code do the heavy lifting:

Option Explicit

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


这篇关于找到三个数字之间的确切差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆