Discussion: Recherche Formule
Afficher un message
Vieux 08/10/2007, 19h22   #18 (permalink)
wilfried_42
XLDnaute Barbatruc
 
Avatar de wilfried_42
 
Date d'inscription: novembre 2006
Localisation: Saint etienne
Version Excel : Excel XP (PC)
Messages: 3 844
Par défaut Re : Recherche Formule

re:

s'il y en a que ca interresse, voici une fonction personalisée remplacant NB.SI mais fonctionnant sur des plages discontinues nommées

Code:
Function gw_nbsi(plage As Range, signe As String, valeur As Range) As Long
    Application.Volatile
    gw_nbsi = 0
    Dim i As Long, gwcel As Range
    For Each gwcel In Range(plage.Address)
        Select Case signe
            Case "="
                If gwcel = valeur Then gw_nbsi = gw_nbsi + 1
            Case "<>", "><"
                If gwcel <> valeur Then gw_nbsi = gw_nbsi + 1
            Case ">"
                If gwcel > valeur Then gw_nbsi = gw_nbsi + 1
            Case "<"
                If gwcel < valeur Then gw_nbsi = gw_nbsi + 1
            Case ">=", "=>"
                If gwcel >= valeur Then gw_nbsi = gw_nbsi + 1
            Case "<=", "=<"
                If gwcel <= valeur Then gw_nbsi = gw_nbsi + 1
            Case Else
                 MsgBox "Le signe n'est pas correct"
                 Exit Function
        End Select
    Next
End Function
utilisation : =gw_nbsi(plage,"Signe",cellule) : cellule contient la valeur testée


Bonne soirée
__________________
salutations

Wilfried

Plus j'apprends, plus je sais....... plus je sais que je ne sais rien.

Venez visiter mon zoo : Cliquez ici il est si petit, un petit click quotidien merci
wilfried_42 est déconnecté   Réponse avec citation