首页 \ 问答 \ 使用COUNTIF按颜色计数单元格(Count Cells By Colour with COUNTIF)

使用COUNTIF按颜色计数单元格(Count Cells By Colour with COUNTIF)

我有以下宏CountCellsByColor(ORIGNAL BELOW)但是我想修改它,以便按颜色和单元格的特定文本计算单元格。

例如:该范围有5个不同的名称,所有颜色都有不同的颜色。 我希望宏只计算与参考单元格具有相同名称和颜色的单元格。 即“Fred”'yellow'cells的数量

以下原始公式:

Function CountCellsByColor(rData As Range, cellRefColor As Range) As Long
    Dim indRefColor As Long
    Dim cellCurrent As Range
    Dim cntRes As Long

    Application.Volatile
    cntRes = 0
    indRefColor = cellRefColor.Cells(1, 1).Interior.Color
    For Each cellCurrent In rData
        If indRefColor = cellCurrent.Interior.Color Then
            cntRes = cntRes + 1
        End If
    Next cellCurrent

    CountCellsByColor = cntRes
End Function

I have the following macro CountCellsByColor (ORIGNAL BELOW) however I want to amend it so that it counts cells by color AND the specific text of the cell.

eg: The range has 5 different names all colored a different colour. I want the macro to only count the cells with the same name and color as the reference cell. ie Number of "Fred" 'yellow'cells

ORIGINAL FORMULA BELOW:

Function CountCellsByColor(rData As Range, cellRefColor As Range) As Long
    Dim indRefColor As Long
    Dim cellCurrent As Range
    Dim cntRes As Long

    Application.Volatile
    cntRes = 0
    indRefColor = cellRefColor.Cells(1, 1).Interior.Color
    For Each cellCurrent In rData
        If indRefColor = cellCurrent.Interior.Color Then
            cntRes = cntRes + 1
        End If
    Next cellCurrent

    CountCellsByColor = cntRes
End Function

原文:https://stackoverflow.com/questions/38966147
更新时间:2022-08-23 22:08

最满意答案

AppFabric缓存客户端库仅限.NET,您无法直接从ASP使用它们。

如果你要在.NET(一个有效的外观 )中编写一个COM可见对象,你可以在ASP页面中实例化那些与AppFabric缓存通信的对象,你可能会解决这个问题。


The AppFabric caching client libraries are .NET-only, you can't use them directly from ASP.

You might be able to get round this if you were to write a COM-visible object in .NET (a facade, effectively) that you could instantiate in your ASP pages that would talk to the AppFabric cache.

相关问答

更多
  • 当Velocity应用于web开发时,界面设计人员可以和java程序开发人员同步开发一个遵循MVC架构的web站点   也就是说,页面设计人员可以只关注页面的显示效果,而由java程序开发人员关注业务逻辑编码。   Velocity将java代码从web页面中分离出来,这样为web站点的长期维护提供了便利,同时也为我们在JSP和PHP之外又提供了一种可选的方案。
  • 我们最近做了大量Velocity和Memcached的比较。 简而言之,我们发现Velocity的速度比Memcached慢3至5倍,并且(更重要的是)它目前不支持多重获取操作。 所以目前,我会建议使用Memcached。 另外,我们学到的另一个教训是分布式缓存中最慢的操作是序列化和反序列化(至少在ASP.NET中)。 进程内ASP.NET缓存的数量级更快。 所以你必须更仔细地选择缓存策略。 We have done recently a fair amount of comparing of Veloci ...
  • Redis ! 这就像关于类固醇的记忆(好的)。 这 是 一些 司机 。 Redis是一家高级键值商店。 它与memcached类似,但数据集不是易失性的 ,值可以是字符串,与memcached完全相同,但也包括列表,集合和有序集 。 所有这些数据类型都可以通过原子操作来操作以推送/弹出元素,添加/删除元素,执行服务器端并集,交集,集合之间的差异等等。 Redis支持不同类型的排序功能。 Redis! It's like memcache on steroids (the good kind). Here ...
  • 那你怎么知道它慢一点? 或者你怎么知道它是序列化? 我最近在性能优化上花了很多时间,在提出解决方案之前,我必须说你需要首先根据事实来探讨问题: 建立没有memcached的基线基准 使用memcached和compare运行相同的基准测试 如果速度肯定较慢,请使用分析工具确定您的瓶颈究竟在哪里 确定瓶颈后,尝试隔离该代码区域并在项目外创建一个独立的测试用例。 然后尝试找出为什么需要更长的时间并尝试不同的方法。 (我和其他人当时可以帮助你) 根据我的经验,序列化不应该那么慢。 为了进行基准测试,您可以免费使用 ...
  • 我们必须使用jQuery来获取选择,querySelector是不够的。 We have to use jQuery to get the selection, querySelector is not enough.
  • 由于Enyim是开源的,您可以编辑ServerPool.cs ,如下所示: /// /// Marks a node as dead (unusable) /// - moves hte node to the "dead list" /// - recreates the locator based on the new list of still functioning servers /// ///
  • AppFabric缓存客户端库仅限.NET,您无法直接从ASP使用它们。 如果你要在.NET(一个有效的外观 )中编写一个COM可见对象,你可以在ASP页面中实例化那些与AppFabric缓存通信的对象,你可能会解决这个问题。 The AppFabric caching client libraries are .NET-only, you can't use them directly from ASP. You might be able to get round this if you were to ...
  • 你也可以使用memcached 。 还有其他的选择 。 您也可以查看Scott Gu的帖子,了解ASP.NET 4.0中引入的新缓存可扩展性模型。 You can use memcached also. There are also other alternatives. You may also check Scott Gu's post about the new cache extensibility model introduced in ASP.NET 4.0.
  • 您是否尝试在IIS中启用32位应用程序支持? http://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx Have you tried enabling 32 bit applications support in IIS? http://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-applic ...
  • 是的,您正好阅读该区域仅存在于一个主机中的文档。 “如果每个主机保留自己的缓存,我实际上不会有任何问题,只要我能以某种方式同步它们。” 当你说同步时,你的意思是什么时候启用HA? 如果这就是你的意思,Velocity实际上会照顾到它。 对于问题:1。否2.是3.通知将发送给客户。 所以我不确定是否还有向其他主机发送通知。 4.区域提供搜索功能并从您身上夺走HA。 在您的情况下,您可以使用HA的优势。 Yes you are right in reading the doc that the region w ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)