gpt4 book ai didi

excel - 计算包含特定值的单元格

转载 作者:行者123 更新时间:2023-12-02 18:37:40 26 4
gpt4 key购买 nike

嗨,我是 Excel 新手,我想计算包含 500 到 750 之间值的单元格。这是我编写的代码,但我做错了一些事情,没有给我正确的答案。有人可以帮忙吗?

Sub Count()
Dim i As Integer
Dim j As Integer

Range("C3").Select

For i = 1 To 279
For j = 1 To 19
If i > 500 Then
ElseIf i <= 750 Then
i = i + 1
End If
Next j
Next i

Sheets("Sheet1").Select
Range("B13").Select
ActiveCell.Value = i
End Sub

最佳答案

为什么要使用 VBA?

使用COUNTIFS()功能。只需在单元格 B13 中输入它,然后将范围从 A:A 调整为您需要在公式中检查的任何范围。

=COUNTIFS(A:A, ">=500", A:A, "<=750")

关于excel - 计算包含特定值的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16578036/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com