Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Sum cells with specific format

Hi

How do I go about summing all the cells in a row based on their number format.

I will only have either 0.00% or #,##0.00 and need to sum the non pct
formatted cells.

Thanks in advance.

Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Sum cells with specific format

walk on water at the weekends do you,

thanks vm for your help, it's exactly what I needed.

I really do have to get my head around udf's

thanks again

"Nigel" wrote:

You do not say where you want to sum this, but if it is in a sheet try using
the following UDF (not fully tested).

use it by placing in a cell

=sumformat(A1:IV1)


Function sumformat(rngS As Range)
Dim rngC As Range
sumformat = 0
If Not rngS Is Nothing Then
For Each rngC In rngS
If rngC.NumberFormat < "0.00%" Then
sumformat = sumformat + rngC.Value
End If
Next
End If
End Function

--

Regards,
Nigel




"Richard" wrote in message
...
Hi

How do I go about summing all the cells in a row based on their number
format.

I will only have either 0.00% or #,##0.00 and need to sum the non pct
formatted cells.

Thanks in advance.

Regards


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Sum cells with specific format

Sorry I jumped the gun a little there, it worked great the first time, but
now all I get in the cell where the function is entered is #NAME?
The UDF is entered as part of a macro, but this shouldn't make any difference.

Can you advise
Thanks

"Nigel" wrote:

You do not say where you want to sum this, but if it is in a sheet try using
the following UDF (not fully tested).

use it by placing in a cell

=sumformat(A1:IV1)


Function sumformat(rngS As Range)
Dim rngC As Range
sumformat = 0
If Not rngS Is Nothing Then
For Each rngC In rngS
If rngC.NumberFormat < "0.00%" Then
sumformat = sumformat + rngC.Value
End If
Next
End If
End Function

--

Regards,
Nigel




"Richard" wrote in message
...
Hi

How do I go about summing all the cells in a row based on their number
format.

I will only have either 0.00% or #,##0.00 and need to sum the non pct
formatted cells.

Thanks in advance.

Regards


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Sum cells with specific format

Nigel

Thanks for getting back to me on this.

Yes I have stored it in a standard module. It's odd as when I either edit
the cell with the udf and then enter with no changes, or I sort the table in
which the udf is included, the correct result appears. Unfortunately I
either have to edit each cell that contains the udf, or sort twice, once to
get the result and once to perform the sort.

Richard

"Nigel" wrote:

Hi
Not sure about walking on water at anytime!

Where have you stored the function? It should be in a standard module.


--

Regards,
Nigel




"Richard" wrote in message
...
Sorry I jumped the gun a little there, it worked great the first time,
but
now all I get in the cell where the function is entered is #NAME?
The UDF is entered as part of a macro, but this shouldn't make any
difference.

Can you advise
Thanks

"Nigel" wrote:

You do not say where you want to sum this, but if it is in a sheet try
using
the following UDF (not fully tested).

use it by placing in a cell

=sumformat(A1:IV1)


Function sumformat(rngS As Range)
Dim rngC As Range
sumformat = 0
If Not rngS Is Nothing Then
For Each rngC In rngS
If rngC.NumberFormat < "0.00%" Then
sumformat = sumformat + rngC.Value
End If
Next
End If
End Function

--

Regards,
Nigel




"Richard" wrote in message
...
Hi

How do I go about summing all the cells in a row based on their number
format.

I will only have either 0.00% or #,##0.00 and need to sum the non pct
formatted cells.

Thanks in advance.

Regards




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Sum cells with specific format

Hello,

I suggest to use my format-independant UDF:
http://www.sulprobil.com/html/sum_my_format.html

Regards,
Bernd
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
Find Cells with Specific Format Jim Parsells Excel Programming 1 August 13th 08 09:48 PM
Add cells with a specific format? qwery Excel Programming 2 November 11th 05 05:05 PM
Can I format to always AutoFilter specific cells BCantrell Excel Worksheet Functions 1 July 8th 05 11:50 PM
Selecting cells that contain text in a specific format nicad_adam Excel Discussion (Misc queries) 1 June 17th 05 05:19 AM
How do I format cells to a specific number of digits? Gabriele Excel Discussion (Misc queries) 3 February 5th 05 03:17 PM


All times are GMT +1. The time now is 01:20 AM.

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"