# Combining the contents of a range of cells into one cell, as a formula.



## Wayne Burman (Jan 4, 2023)

Hi, 

Is it possible to combine the number contents of a range of cells into one cell, but as a formula containing each number?

For example, if I have three adjacent cells with the following numbers in them: 3, 4 & 5.
I want to combine them into another cell, so that the new cell's contents are =3+4+5.
The new cell will show the answer of that formula, i.e. 12, but when I edit the cell, I can see the individual numbers that make up the sum.

Thanks very much,
Wayne


----------



## Joe4 (Jan 5, 2023)

Welcome to the Board!

Let's say that your range is A1:C1 and you want to put the formula in cell D1.
Then you could run a short VBA procedure like this to do that:

```
Sub CreateFormula()
    Range("D1").Formula = "=" & Range("A1").Value & "+" & Range("B1").Value & "+" & Range("C1").Value
End Sub
```


----------



## Wayne Burman (Jan 5, 2023)

Thanks Joe4, much appreciated.


----------



## Peter_SSs (Jan 5, 2023)

Just be aware that this resulting formula will not actually be linked to those input cells like a normal formula. 
That is, if the value in cell A1 is altered, neither the formula nor value in cell D1 will change.


----------



## Wayne Burman (Jan 5, 2023)

Peter_SSs said:


> Just be aware that this resulting formula will not actually be linked to those input cells like a normal formula.
> That is, if the value in cell A1 is altered, neither the formula nor value in cell D1 will change.


Oh, okay, thanks for the heads up. The values shouldn't change, so should be okay.


----------

