访问最大功能:返回10个字段中的第二个最高值 [英] Access Maximum Function: Return the second highest value across 10 fields

查看:39
本文介绍了访问最大功能:返回10个字段中的第二个最高值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码效果很好,除非第一个字段为零或行中的所有字段都包含零(见图)。


非常感谢!

The code works great except if the first field is a zero or all the fields in the row contain zeros (see pic).

Many thanks!

展开 | 选择 | Wrap | 行号

推荐答案

利亚姆,

欢迎来到字节!有几个问题阻碍了你想要的答案。首先,任何时候所有数字都相同(不仅仅是零),代码将无法处理它,因为你过滤掉了所有的变量。你可以通过计算数字相同的次数来解决这个问题 - 如果它们总是相同的,只需将你想要的东西插入到字段中(因为没有第二高的数字,我不知道这是什么将会)。此外,如果将值保留为变量,您将遇到一些有趣的问题。我在下面的代码中将它们更改为整数。

Liam,
Welcome to Bytes! There are a couple issues keeping you from the answer you want. First, anytime all the numbers are the same (not just zeroes), the code won''t be able to handle it because you''re filtering out all the variables. You can solve this by counting how many times the numbers are the same--if they are always the same, just force insert what you want into the field (since there is no second-highest number, I''m not sure what this would be). Also, you''ll run into some interesting problems if you leave the values as variables. I changed them to integers in the code below.

展开 | 选择 | Wrap | 行号


liamthequietman,

如果你愿意让我有机会修改gnawoncents的优秀建议....

liamthequietman,

If you will indulge me the opportunity to modify gnawoncents''s excellent suggestion....

展开 | 选择 | Wrap | 行号


twinnyfo,


非常好 - 更优雅。 *启动慢拍*
twinnyfo,

Very nice--much more elegant. *initiates slow clap*


这篇关于访问最大功能:返回10个字段中的第二个最高值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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