Can Excel 2013 show the formula instead of the value only in certain cells?

Solution 1:

If you have a lot of data you could use this simple VBA method which I believe goes after what you want, or at least points you in the right direction. First of all you can't display the formula and have it calculate without duplicating the cell

If you can get past that part then the next step is to either manually copy each cell and display it as text or use a VBA method like below to do it for you.

I created this sub to show you how to get the formula property of a cell:

Public Sub test()
Range("C1").NumberFormat = "@"
Range("C1").Value = Range("B1").Formula
End Sub

I simply put that formula into a side column as text:

enter image description here

You could of course apply a loop to this to go through an entire sheet.

The other way to achieve what you are looking for is to understand that my argument Range("B1").formula can be set or retrieved. This means that hypothetically you could do it backwards:

dim value as string
value = Range("B1").formula

..then you could use the variable value in additional formulas allowing your formula to be displayed and calculated at the same time.

Hopefully this helps you along your way.

Solution 2:

Here is a simple way to get the cells in column F that contain formulas to display the formula rather than the value. Run this short macro:

Sub ShowFormula()
   Dim DQ As String, mesage As String
   Dim rng As Range, r As Range
   DQ = Chr(34)
   Set rng = Range("F:F").Cells.SpecialCells(xlCellTypeFormulas)

   For Each r In rng
      mesage = DQ & r.Formula & DQ
      r.NumberFormat = mesage & ";" & mesage & ";" & mesage & ";"
   Next r
End Sub

For example:

enter image description here

Explanation:

Without using VBA, it is possible to completely override the display of a value in a cell by using a Custom Format like:

enter image description here

The macro does a similar function, but uses the cell's formula as the forced display.