sábado, maio 14, 2005

Duas dicas sobre funções Matriciais

"Basta sermos simples para sermos ricos em nossos atos!" (E.S.P.)
----------

Supondo que temos o intervalo "A1:A7" com valores de 1 a 7 respectivamente.
Por intermédio de funções matriciais poderemos contar um intervalo ou fazer cálculos com critérios:

{=SOMA((A1:A7>2)*(A1:A7<7))}

Nesse exemplo, temos como resultado a contagem dos valores maiores que 2 e menores que 7.

********

{=SOMA((A1:A7>2)*(A1:A7<7)*a1:a7)}

Nesse exemplo, temos como resultado a soma dos valores maiores que 2 e menores que 7.

********
Sempre antes de finalizar a função matricial, usar "CTRL + SHIFT + ENTER".

----------
"O potencial humano só é medido por intermédio dos atos!" (E.S.P.)

Transferência de dados para outra planilha

"Basta sermos simples para sermos ricos em nossos atos!" (E.S.P.)
----------

Private Sub Worksheet_Change(ByVal Target As Range)
'
'Autor: Eneias dos Santos Pedroso
'
If Target.Row = 1 Or Target.Row = 2 Then Exit Sub

For j = 0 To 4997
If Target.Column = 14 Then
If Worksheets(2).Cells(j + 4, 1) = "" Then
Worksheets(2).Cells(j + 4, 1) = Cells(Target.Row, Target.Column - 13)
Worksheets(2).Cells(j + 4, 2) = Cells(Target.Row, Target.Column - 12)
Worksheets(2).Cells(j + 4, 3) = Cells(Target.Row, Target.Column - 11)
Worksheets(2).Cells(j + 4, 4) = Cells(Target.Row, Target.Column - 10)
Worksheets(2).Cells(j + 4, 5) = Cells(Target.Row, Target.Column - 9)
Worksheets(2).Cells(j + 4, 6) = Cells(Target.Row, Target.Column - 8)
Worksheets(2).Cells(j + 4, 7) = Cells(Target.Row, Target.Column - 7)
Worksheets(2).Cells(j + 4, 8) = Cells(Target.Row, Target.Column - 6)
Worksheets(2).Cells(j + 4, 9) = Cells(Target.Row, Target.Column - 5)
Worksheets(2).Cells(j + 4, 10) = Cells(Target.Row, Target.Column - 4)
Worksheets(2).Cells(j + 4, 11) = Cells(Target.Row, Target.Column - 3)
Worksheets(2).Cells(j + 4, 12) = Cells(Target.Row, Target.Column - 2)
Worksheets(2).Cells(j + 4, 13) = Cells(Target.Row, Target.Column - 1)
Worksheets(2).Cells(j + 4, 14) = Cells(Target.Row, Target.Column)
Exit For
End If: End If: Next j

End Sub

----------
Maiores esclarecimentos, acesse o link que está no título deste post !