首页 \ 问答 \ 具有excel最大条件的Sumproduct(Sumproduct with max condition in excel)

具有excel最大条件的Sumproduct(Sumproduct with max condition in excel)

我有这个公式,但它不起作用

=SUMPRODUCT(--(NUMBERVALUE(RIGHT(Sheet1!A:A,2))=MAX(NUMBERVALUE(Sheet1!A:A,2))),--(Sheet1!AG:AG=A9),(Sheet1!AA:AA))

我的问题是在sumproduct的第一节数组中

NUMBERVALUE(RIGHT(Sheet1!A:A,2))=MAX(NUMBERVALUE(Sheet1!A:A)))

A列包含以下类型的值:

Till_Date
2016/10
2016/10
2016/11
2016/11
2016/12
2016/8

等等..

对于每一行,我想在月份中设置一个条件,如果它是整列中的最后一个月,那么想法是获得正确的2位数的最大值,并且对于每一行,比较正确的2位数字与最大值整栏。

然而它没有工作,感觉我非常接近修复它但无法找到问题

任何援助都将非常感谢。

提前致谢

Georges Sabbagh


I have this formula but it's not working

=SUMPRODUCT(--(NUMBERVALUE(RIGHT(Sheet1!A:A,2))=MAX(NUMBERVALUE(Sheet1!A:A,2))),--(Sheet1!AG:AG=A9),(Sheet1!AA:AA))

My problem is in the first section array of the sumproduct

NUMBERVALUE(RIGHT(Sheet1!A:A,2))=MAX(NUMBERVALUE(Sheet1!A:A)))

The column A contain the below kind of values:

Till_Date
2016/10
2016/10
2016/11
2016/11
2016/12
2016/8

etc..

For each row, I want to set a condition on the month if it is the last month in the whole column, so the idea is to get the max of the right 2 digits and for each row compare right 2 digits with the max value of the whole columns.

However it is not working, feeling that im so close to fix it but could not locate the problem

Any assistance would be much much appreciated.

Thanks in advance

Georges Sabbagh


原文:
更新时间:2022-03-23 17:03

最满意答案

您可以在fun使用模式匹配:

# (fun (Int a) -> a > 0) (Int 1);;
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
Fraction _
- : bool = true

如果传入Fraction显然会引发匹配错误。 如果你想处理这种情况:

# (function Int a -> a > 0 | Fraction {numerator = a; denominator = b}  -> a/b > 0 ) (Int 1);;
- : bool = true

You can use pattern matching in the fun:

# (fun (Int a) -> a > 0) (Int 1);;
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
Fraction _
- : bool = true

Obviously this will raise a match error if you pass in a Fraction. If you want to handle that case:

# (function Int a -> a > 0 | Fraction {numerator = a; denominator = b}  -> a/b > 0 ) (Int 1);;
- : bool = true

相关问答

更多
  • gasche的回答有很好的建议 。 我将多解释一下开放和封闭的工会。 首先,您需要区分两种联合:基本变体(无反码)和多态变体(带反色)。 基本变体是生成性的:如果您在不同的模块M1和M2定义了两个具有相同构造函数名称的类型,则您有不同的类型。 M1.Foo和M2.Foo是不同的构造函数。 无论你在哪里使用它, `Foo总是相同的构造函数。 除此之外,多态变体可以完成一切基本变体可以完成的工作。 但是,拥有巨大力量会带来极大的复杂性,因此只有在必要和谨慎的情况下才能使用。 多态变体类型描述了该类型可能具有的构 ...
  • 做这样的事情的正确方法是做到以下几点: 在orders.mli中写道: (* This define the signature *) module type ORDERING = sig type t val isLess : t -> t -> bool end (* This define a module having ORDERING as signature *) module StringOrdering : ORDERING 编译文件: ocamlc -c ordering.m ...
  • OCaml中的歧视联盟就像一个C联盟和一个枚举。 所以你的一个number类型的例子可以像这样在C中表示: enum number_tag { ZERO, INTEGER, REAL }; union number_value { int i; /* Only access this if tag is INTEGER */ float f; /* Only access this if tag is REAL */ }; struct number { enum num ...
  • boolean和unions具有相似行为的原因是因为编译器将boolean视为文字类型true和false并集,因此type boolean = true | false type boolean = true | false (虽然此定义不明确存在) 行为的原因是通过设计条件类型分布在联合上。 这是设计的行为,允许实现各种强大的功能。 您可以在此处详细了解该主题 如果您不希望条件分布在联合上,则可以在元组中使用该类型(这将阻止该行为) class MyGeneric { } type Replac ...
  • 联合和相交类型只是将类型视为值集(主要是无限集)。 如果这就是你如何考虑类型,那么对集合进行的任何操作都可以应用于类型(值集),以创建一个新类型(一组值),至少在概念上。 在某种意义上,联合类型与总和类型相似,您似乎很熟悉。 事实上,我经常听到描述为“歧视联盟”类型的总和类型。 基本的区别在于像(Haskell符号) data FooBar = Foo Integer | Bar String的和类型 data FooBar = Foo Integer | Bar String允许您判断给定的FooBar值 ...
  • 因为你需要声明一个对象可以返回多种类型中的一种(在你的情况下是一个int或str ,或者在另一个例子str或NoneType ),所以只有当你使用静态类型语言时才需要联合输入。 Python只处理对象 ,因此永远不需要考虑'联合类型'。 如果程序员想要为不同的结果返回不同的类型,那么Python函数会返回他们返回的结果,然后这是他们的选择。 那么选择是一个架构选择,对Python解释器没有任何影响(所以这里没有什么可以'测试')。 Python 3.5确实引入了用于创建可选类型提示的标准,并且该标准包括Un ...
  • OCaml已经知道它们是相同的定义 - 除非你做一些奇怪的事情来隐藏抽象类型,它会将StringSet.elt list和string list视为相同的类型。 OCaml already knows that they are identically defined - unless you're doing something strange to hide the types beind an abstraction, it will treat a StringSet.elt list and st ...
  • 查看类型别名 type FirstOrSecond = FirstType | SecondType; Look at type aliases type FirstOrSecond = FirstType | SecondType;
  • 您可以在fun使用模式匹配: # (fun (Int a) -> a > 0) (Int 1);; Warning 8: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: Fraction _ - : bool = true 如果传入Fraction显然会引发匹配错误。 如果你想处理这种情况: # (function Int a -> a > 0 | Fraction {n ...
  • 如果你需要的只是存储类型名,那么你可以使用typerep库来检索它们,然后调整sexp转换器来处理这些信息。 另一种选择是将数据实际存储为有效的OCaml字符串,并使用编译器库加载它,即实际解析和评估。 在这种情况下,您可以存储您想要的类型或任何内容。 您可能会发现odn库对于将数据转储为OCaml非常有用。 If all that you need is to store typenames, then you can use typerep library, to retrieve them, and ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。