In 2 cells, I exactly have these values:
A1: 1+2+3
A2: 2+0.5+10
Is it possible to have sum of these cells (=18.5) in another cell?
I tried =SUM(A1:A2)
, but it returns 0
In 2 cells, I exactly have these values:
A1: 1+2+3
A2: 2+0.5+10
Is it possible to have sum of these cells (=18.5) in another cell?
I tried =SUM(A1:A2)
, but it returns 0
This can't be the most efficient use of this method, but it's what I can figure out. Hopefully someone has something better.
Make sure you have the developer tab in the ribbon. If not, go to File - Options - Customize Ribbon
and on the right side place a checkmark in the box for Developer
Now go to the developer tab and on the left you'll see Visual Basic
- click that
On the left of your Visual Basic window you will see your VBAProject
, right click insert - module
and paste the code below into the module
Function Kikio(Rng As String) As Variant
Kikio= Evaluate(Rng)
End Function
Click Debug - Compile VBAProject
and exit the visual basic window
Now on your sheet you can use the function =Kikio()
to calculate a sum of one of those cells. Use this in conjunction with =Sum()
to sum multiple =Kikio()
s in this particular Workbook.
=Sum(Kikio(A1), Kikio(A2))
If you want the =Kikio()
function available across all workbooks on the machine, you'll need to put it into your PERSONAL.xlsb
file.
I always prefer non-VBA solutions. There is an undocumented "Evaluate" function that you can use, but I wouldn't recommend using it for very large data sets. Here's how it works.
Under the Formula
tab, Pick define name. Name it whatever you want (I used "Result"). And in the "Refers to", type in =EVALUATE(Sheet1!A1)+EVALUATE(Sheet1!A2)
. you don't have to specify a sheet, but it will do that automatically for you after entering.
Now to use that result, just select a cell and type in "Result" and there you will find the result you want.
If you want to use bigger data sets, VBA might be needed, unless you don't mind the manuel work.
=Result(A1,A2)
means =EVALUATE(Sheet1!A1)+EVALUATE(Sheet1!A2)
and =Result(B1,B2)
means =EVALUATE(Sheet1!B1)+EVALUATE(Sheet1!B2)