Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- = CONCATENATE("= (";SUBSTITUTE(FORMULATEXT(A1);"=";"");") + (";SUBSTITUTE(FORMULATEXT(B1);"=";"");")
- =CombineFormulas(A1:B1,"+")
- Option Explicit
- Public Function CombineFormulas(RangeToCombine As Range, Operator As String)
- 'Input: Range of cells and an operator to use when combining their formulas
- 'Output: String of the combined formulas
- Dim cell As Range
- Dim s As String
- s = "="
- For Each cell In RangeToCombine.Cells
- If Len(s) > 1 Then s = s & Operator
- s = s & "(" & Mid(cell.Formula, 2, Len(cell.Formula)) & ")"
- Next
- Application.Volatile
- CombineFormulas = Evaluate(s)
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement