Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
Avatar do usuário
Por PHSabater
Posts Avatar
#70271
Via fórmula não sei se é possível ter esse resultado que espera somente informando essas condições.

Em VBA é possível.

O código abaixo te entrega o resultado esperado, ele vai contar se na coluna E e coluna G tiverem os campos da busca (2 e 4).
Código: Selecionar todos
Sub LocalizarOcorrencias()
    Dim lBusca As Long
    Dim Result As Integer
    Dim strResult As String, vLinha As String
    
    lBusca = 7 'linha inicial das informações
    Result = 0
    Do Until Plan1.Cells(lBusca, 1) = "" 'Plan1 é o nome da planilha
        If Plan1.Cells(lBusca, "E") = Plan1.Range("B1") And _
            Plan1.Cells(lBusca, "G") = Plan1.Range("D1") Then
                Result = Result + 1
                strResult = Plan1.Cells(lBusca, "A") & " " & Plan1.Cells(lBusca, "B") & "" & _
                            Plan1.Cells(lBusca, "C") & " " & Plan1.Cells(lBusca, "D")
                vLinha = vLinha & " - " & lBusca
        End If
        
    lBusca = lBusca + 1
    Loop
    Plan1.Range("F1") = Result & " ocorrências para " & strResult & " na(s) linha(s) " & vLinha
End Sub
Por babdallas
#70310
Código: Selecionar todos
=SEERRO(ÍNDICE(Tabela1[Texto1];AGREGAR(15;6;(LIN(Tabela1)-LIN(Tabela1[#Cabeçalhos]))/((Tabela1[Texto5]=$B$1)*($D$1=Tabela1[Texto7]));LINS(I$14:I14)));"")
Você não está autorizado a ver ou baixar esse anexo.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord