#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Andy the yeti
 
Posts: n/a
Default How many formula

Hi all,

Is there a way to count up how many formulae there are in workbook across
all the tabs?

Many thanks

Andy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default How many formula

For a single sheet yes, press F5, select special then formulas, now right
click in the status bar to the far right and select count. Otherwise you
need to use a macro

************************************************** ****
Option Explicit

Sub CountFormula()

Dim sh As Worksheet
Dim cell As Range
Dim Count As Integer

For Each sh In ActiveWorkbook.Sheets
For Each cell In sh.UsedRange
If cell.HasFormula Then
Count = Count + 1
End If
Next cell
Next sh

MsgBox "This workbook has " & Count & " formulas"

End Sub

************************************************** ***

--

Regards,

Peo Sjoblom


"Andy the yeti" wrote in message
...
Hi all,

Is there a way to count up how many formulae there are in workbook across
all the tabs?

Many thanks

Andy



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Chip Pearson
 
Posts: n/a
Default How many formula

Only with VBA code.

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas."
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Andy the yeti" wrote in
message
...
Hi all,

Is there a way to count up how many formulae there are in
workbook across
all the tabs?

Many thanks

Andy



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Andy the yeti
 
Posts: n/a
Default How many formula

thank you both !

"Chip Pearson" wrote:

Only with VBA code.

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas."
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Andy the yeti" wrote in
message
...
Hi all,

Is there a way to count up how many formulae there are in
workbook across
all the tabs?

Many thanks

Andy




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default How many formula

I think there's a slight bug in this.

If the worksheet doesn't have a formula, wscount retains its value from the
previous count.

Option Explicit

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount = 0 '<-- added
WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas."
End Sub


Chip Pearson wrote:

Only with VBA code.

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas."
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Andy the yeti" wrote in
message
...
Hi all,

Is there a way to count up how many formulae there are in
workbook across
all the tabs?

Many thanks

Andy


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Chip Pearson
 
Posts: n/a
Default How many formula

Dave,

You're right. WSCount needs to be reset to zero for each sheet.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dave Peterson" wrote in message
...
I think there's a slight bug in this.

If the worksheet doesn't have a formula, wscount retains its
value from the
previous count.

Option Explicit

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount = 0 '<-- added
WSCount =
WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas."
End Sub


Chip Pearson wrote:

Only with VBA code.

Sub CountFormulas()
Dim TotalCount As Long
Dim WSCount As Long
Dim WS As Worksheet
On Error Resume Next
For Each WS In ActiveWorkbook.Worksheets
WSCount =
WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t
TotalCount = TotalCount + WSCount
Next WS
MsgBox "You have " & Format(TotalCount, "#,##0") & "
formulas."
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Andy the yeti" wrote
in
message
...
Hi all,

Is there a way to count up how many formulae there are in
workbook across
all the tabs?

Many thanks

Andy


--

Dave Peterson



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
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Hide formula skateblade Excel Worksheet Functions 10 October 15th 05 08:36 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM


All times are GMT +1. The time now is 09:36 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"