Jump to content

10 AUSENTES...!


andre-sp

Recommended Posts

Guest Zangado

fiz uma função para numeres ausentes

 

com um pouco de criatividade pode sr achar varios usos

 

=NunAusente(Range; ocorrência ; Valor minimos ; valor maximo)

=NunAusente(C10:Q10 ; 1 ; 1 ; 25)

vai retornar a 1ª ocorrencia que falta  de um numero de 1 até 25 em C10 até Q10

 

18 - 9 - 12 - 21 - 22 - 25 - 3 - 8 - 10 - 19 - 2 - 5 - 15 - 17 - 1 -

ausentes:

1ª - 2ª - 3ª - 4ª - 5ª - 6ª - 7ª - 8ª - 9ª - 10ª -

.

4 - 6 - 7 - 11 - 13 - 14 - 16 - 20 - 23 - 24 -  
Function NunAusente(ByVal Rang As Range, ByVal Ocorrencia As Long, ByVal Menor As Long, ByVal Maior As Long) As Long    reg1 = Rang.Value2    Lc1 = UBound(reg1, 1): Cc1 = UBound(reg1, 2)    ocr = 0    For v = Menor To Maior        ttL = 0:        GoSub tes         If ttL = 0 Then ocr = ocr + 1        If ocr = Ocorrencia And ttL = 0 Then NunAusente = v: Exit Function    Next    Exit Functiontes:    For L = 1 To Lc1        For c = 1 To Cc1            If reg1(L, c) = v Then ttL = 1: Exit For        Next: NextReturnEnd Function
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...