I want to create a formula, that combines the SUM IF (SUMMEWENN) and a SUMBOLD (SUMMEFETT) functions.
我想创建一个公式,它结合了SUMIF(SUMMEWENN)和SUMBOLD(SUMMEFETT)函数。
I already found a SUMBOLD formula from here but I don't know how to create the SUMIFBOLD (SUMMEWENNFETT) formula, can anyone tell me the vba-code?
Thank you.
我已经从这里找到了一个SUMBOLD公式,但我不知道如何创建SUMIFBOLD(SUMMEWENNFETT)公式,有人能告诉我vba代码吗?非常感谢。
更多回答
The code you point at has an if statement: If IsNumeric(Zelle.Value) Then Summe = Summe + Zelle.Value
so all you need to do is add and conditions to it.
What is not working with code you point at? How have you tried to modify it? And what's your condition for SUM IF?
您所指向的代码中有什么不起作用?你是如何修改的?你的SUM IF条件是什么?
优秀答案推荐
Here is the function:
功能如下:
Function SumIfBold(rng_crit As Range, rng_sum As Range) As Double
Dim Total As Double
Dim i As Long
Total = 0 ' Initialize the total to zero
' Check if both ranges have the same number of cells
If rng_crit.Cells.Count <> rng_sum.Cells.Count Then
SumIfBold = 0 ' Return 0 if the ranges don't match
Exit Function
End If
For i = 1 To rng_crit.Cells.Count
If rng_crit.Cells(i).Font.Bold = True Then
Total = Total + rng_sum.Cells(i).Value
End If
Next i
SumIfBold = Total ' Return the total
End Function
更多回答
我是一名优秀的程序员,十分优秀!