单格求和和空白格

Single cell sum and blank cell

我正在使用此宏对单个单元格中的单个数字求和,以逗号分隔

Function Individual(R As Range) As Double
   Individual = Evaluate(Replace(R.Value, ",", "+"))
End Function

函数如下所示 =Individual(XY),其中 XY 是 "source" 写入单个数字的单元格。

如何修改宏以在 "source" 单元格为空白时将 0 写入 "target" 单元格?

Function Individual(R As Range) As Double
  if len(r.value) > 0 then
    Individual = Evaluate(Replace(R.Value, ",", "+"))
  else
    Individual = 0
  end if
End Function