Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions User Defined > PERCENTARE< Previous | Next > 

 

PERCENTARE(rgeValues, sCondition, iDecimalPlaces)

 
 

Returns the percentage of numbers in a range that meet a particular condition.

 

 
rgeValuesThe range of values.
sConditionThe condition you want to use.
iDecimalPlacesThe number of decimal places you want the percentage returned as.
 

 

REMARKS

 
 
  • ??

     

     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    Option Explicit

    Public Function PERCENTARE(ByVal rgeValues As Range, _
                               ByVal sCondition As String, _
                               ByVal iDecimalPlaces As Integer) As Double

       Call Application.Volatile(True)

       PERCENTARE = VBA.Round((Application.WorksheetFunction.CountIf(rgeValues, sCondition) / _
                     Application.WorksheetFunction.Count(rgeValues)) * 100, iDecimalPlaces)

    End Function
       

     

    Example

     
       

     Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >