cells.value vs cells.formula

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
In this code, I do not see any difference between cell.value and cells.formula when it comes to entering a formula.
They both did the same thing. Am I right? Is there any case, I have to use cells.formula instead of cells.value? Thank you very much.

Code:
Sub insert_formula()
    Cells(11, 1).Value = "=sum(a1:a10)"
    Cells(12, 1).Formula = "=sum(a1:a10)"
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
They both work like that, however I would always use Formula when entering a formula & Value when entering a value, as I find it far more obvious what is going on, when revisiting the code at some point in the future.
 
Upvote 0
Another point, if you use .Formula & in 2 years someone asks you to change the formula, you can search for .Formula & quickly find the formula to change.
Whereas if you use .Value it will take a lot longer.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top