Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nigel
The solution I found was to enter the udf formula in each cell using a loop. I was previously entering the formula by the use of an array. Ah well, all sorted now. Thanks for the help and advice "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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find Cells with Specific Format | Excel Programming | |||
Add cells with a specific format? | Excel Programming | |||
Can I format to always AutoFilter specific cells | Excel Worksheet Functions | |||
Selecting cells that contain text in a specific format | Excel Discussion (Misc queries) | |||
How do I format cells to a specific number of digits? | Excel Discussion (Misc queries) |