Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Displaying BOTH formulas and values

Is there some easy way to display both the values and the formulas?
I want to be able to show the results of the formulas as well as the
formulas used in obtaining the cell results. I know I can toggle back and
forth by using Ctrl+`, but for what I want to do I now have to display the
formulas and copy the sheet as formulas into a new worksheet, then insert
columns and copy over the results into adjacent columns of cells. Is there
another way of doing this?
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Displaying BOTH formulas and values

That idea is very cumbersome, especially where formulas are complex or
include complicated functions; besides, it puts both the value and the
formula in the same cell.

"Don Guillett" wrote:

=B15*B17 &"=b15*b17"

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray S." wrote in message
...
Is there some easy way to display both the values and the formulas?
I want to be able to show the results of the formulas as well as the
formulas used in obtaining the cell results. I know I can toggle back and
forth by using Ctrl+`, but for what I want to do I now have to display the
formulas and copy the sheet as formulas into a new worksheet, then insert
columns and copy over the results into adjacent columns of cells. Is there
another way of doing this?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Displaying BOTH formulas and values

John Walkenbach macro.

Sub ListFormulas()
'from John Walkenbach
Dim FormulaCells As Range, Cell As Range
Dim FormulaSheet As Worksheet
Dim Row As Integer
Dim ws As Worksheet
' Create a Range object for all formula cells
On Error Resume Next
Set FormulaCells = Range("A1").SpecialCells(xlFormulas, 23)

' Exit if no formulas are found
If FormulaCells Is Nothing Then
MsgBox "No Formulas."
Exit Sub
End If

' Add a new worksheet
Application.ScreenUpdating = False
Set FormulaSheet = ActiveWorkbook.Worksheets.Add
FormulaSheet.Name = "Formulas in " & FormulaCells.Parent.Name

' Set up the column headings
With FormulaSheet
Range("A1") = "Address"
Range("B1") = "Formula"
Range("C1") = "Value"
Range("A1:C1").Font.Bold = True
End With

' Process each formula
Row = 2
For Each Cell In FormulaCells
Application.StatusBar = Format((Row - 1) / FormulaCells.Count, "0%")
With FormulaSheet
Cells(Row, 1) = Cell.Address _
(RowAbsolute:=False, ColumnAbsolute:=False)
Cells(Row, 2) = " " & Cell.Formula
Cells(Row, 3) = Cell.Value
Row = Row + 1
End With
Next Cell

' Adjust column widths
FormulaSheet.Columns("A:C").Cells.WrapText = True ''AutoFit
Application.StatusBar = False
End Sub


Gord Dibben MS Excel MVP


On Tue, 22 Jul 2008 09:03:02 -0700, Ray S.
wrote:

Your macro is useful...I can work with that.

"Don Guillett" wrote:

I must have misunderstood. Sample layout of what you do want. This maybe

Sub showformulainnextcell()
For Each c In Selection
c.Offset(, 1) = "'" & c.Formula
Next
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray S." wrote in message
...
That idea is very cumbersome, especially where formulas are complex or
include complicated functions; besides, it puts both the value and the
formula in the same cell.

"Don Guillett" wrote:

=B15*B17 &"=b15*b17"

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray S." wrote in message
...
Is there some easy way to display both the values and the formulas?
I want to be able to show the results of the formulas as well as the
formulas used in obtaining the cell results. I know I can toggle back
and
forth by using Ctrl+`, but for what I want to do I now have to display
the
formulas and copy the sheet as formulas into a new worksheet, then
insert
columns and copy over the results into adjacent columns of cells. Is
there
another way of doing this?





  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Displaying BOTH formulas and values

WOW...I'll have to study this one a little...I'll let you know tomorrow if I
was able to get it to work nicely for me.

"Gord Dibben" wrote:

John Walkenbach macro.

Sub ListFormulas()
'from John Walkenbach
Dim FormulaCells As Range, Cell As Range
Dim FormulaSheet As Worksheet
Dim Row As Integer
Dim ws As Worksheet
' Create a Range object for all formula cells
On Error Resume Next
Set FormulaCells = Range("A1").SpecialCells(xlFormulas, 23)

' Exit if no formulas are found
If FormulaCells Is Nothing Then
MsgBox "No Formulas."
Exit Sub
End If

' Add a new worksheet
Application.ScreenUpdating = False
Set FormulaSheet = ActiveWorkbook.Worksheets.Add
FormulaSheet.Name = "Formulas in " & FormulaCells.Parent.Name

' Set up the column headings
With FormulaSheet
Range("A1") = "Address"
Range("B1") = "Formula"
Range("C1") = "Value"
Range("A1:C1").Font.Bold = True
End With

' Process each formula
Row = 2
For Each Cell In FormulaCells
Application.StatusBar = Format((Row - 1) / FormulaCells.Count, "0%")
With FormulaSheet
Cells(Row, 1) = Cell.Address _
(RowAbsolute:=False, ColumnAbsolute:=False)
Cells(Row, 2) = " " & Cell.Formula
Cells(Row, 3) = Cell.Value
Row = Row + 1
End With
Next Cell

' Adjust column widths
FormulaSheet.Columns("A:C").Cells.WrapText = True ''AutoFit
Application.StatusBar = False
End Sub


Gord Dibben MS Excel MVP


On Tue, 22 Jul 2008 09:03:02 -0700, Ray S.
wrote:

Your macro is useful...I can work with that.

"Don Guillett" wrote:

I must have misunderstood. Sample layout of what you do want. This maybe

Sub showformulainnextcell()
For Each c In Selection
c.Offset(, 1) = "'" & c.Formula
Next
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray S." wrote in message
...
That idea is very cumbersome, especially where formulas are complex or
include complicated functions; besides, it puts both the value and the
formula in the same cell.

"Don Guillett" wrote:

=B15*B17 &"=b15*b17"

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray S." wrote in message
...
Is there some easy way to display both the values and the formulas?
I want to be able to show the results of the formulas as well as the
formulas used in obtaining the cell results. I know I can toggle back
and
forth by using Ctrl+`, but for what I want to do I now have to display
the
formulas and copy the sheet as formulas into a new worksheet, then
insert
columns and copy over the results into adjacent columns of cells. Is
there
another way of doing this?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i stop formulas from displaying like this =R[-49]C+R[-25] calculator1 Excel Worksheet Functions 3 May 9th 08 03:06 AM
Displaying formulas Debbie Excel Worksheet Functions 6 October 15th 07 10:34 PM
Displaying Cell Formulas Stranded Excel Discussion (Misc queries) 3 September 8th 06 09:14 PM
displaying formulas TechNoFear Excel Discussion (Misc queries) 11 June 21st 06 08:24 PM
finding values and displaying adjacent values willy3211 Excel Worksheet Functions 1 October 12th 05 04:49 PM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"