alexandrevba
bom dia esta tambem consegui fazer rodar
=SOMARPRODUTO(MÁXIMO((A2:A7=A9)*(B2:B7)))
so que eu enverti pra eu localizar o mínino e nao consegue da sempres 0
sera posivel usar esta expressão pra adiquirir o minino ( que no ofice 2010 so aparece "min")
=SOMARPRODUTO(MIN((A2:A7=A9)*(B2:B7)))
SOBRES AS MACROS FUNÇÃO UMA CONSEGUI FAZER RODA SO QUE ELAS SO TRABLHA COM NUMERO INTEIRO E ALEN DOS NUMEROS INTEIRO
TENHO UMA QUE BUSCA VALOR + A MATRIZ CRITERIO E O CRITERIO E DATA AI ELA MOSTRA COMO ZERO FORMATANDO AS CELULAS PRA GERAL AI FUNCIONA SO SERIA MUITO BOM TIVER COMO AGENTE FIZESSE QUE FUNCIONASSE COM AFORMATAÇÃO
ESTA E MACRO
Option Explicit
'These functions have been developed by Alan Forster on 27th September 2004.
'After years of desire he has actually written them!
'The functions use the same evaluation methods as the CountIf and SumIf functions
Public Function MinIf(rngEvaluate As Range, _
strCondition As String, _
Optional rngValues As Range = Nothing) As Variant
Dim varValue As Variant
Dim bolValueSet As Boolean
Dim intRow As Integer, _
intCol As Integer
If (rngValues Is Nothing) Then Set rngValues = rngEvaluate
bolValueSet = False
If Not RangesOK(rngEvaluate, rngValues) Then
'Return an error value
varValue = "Error in range selection"
Else
'If the ranges are not identically sized can not get this far!
For intRow = 1 To rngEvaluate.Rows.Count
For intCol = 1 To rngEvaluate.Columns.Count
If Application.CountIf(rngEvaluate(intRow, intCol), strCondition) = 1 Then
If bolValueSet Then
If varValue > rngValues(intRow, intCol) Then varValue = rngValues(intRow, intCol)
Else
bolValueSet = True
varValue = rngValues(intRow, intCol)
End If
End If
Next intCol
Next intRow
End If
MinIf = varValue
End Function
Public Function MaxIf(rngEvaluate As Range, _
strCondition As String, _
Optional rngValues As Range = Nothing) As Variant
Dim varValue As Variant
Dim bolValueSet As Boolean
Dim intRow As Integer, _
intCol As Integer
If (rngValues Is Nothing) Then Set rngValues = rngEvaluate
bolValueSet = False
If Not RangesOK(rngEvaluate, rngValues) Then
'Return an error value
varValue = "Error in range selection"
Else
'If the ranges are not identically sized can not get this far!
For intRow = 1 To rngEvaluate.Rows.Count
For intCol = 1 To rngEvaluate.Columns.Count
If Application.CountIf(rngEvaluate(intRow, intCol), strCondition) = 1 Then
If bolValueSet Then
If varValue < rngValues(intRow, intCol) Then varValue = rngValues(intRow, intCol)
Else
bolValueSet = True
varValue = rngValues(intRow, intCol)
End If
End If
Next intCol
Next intRow
End If
MaxIf = varValue
End Function
Private Function RangesOK(rng1 As Range, rng2 As Range) As Boolean
Dim bolAreas As Boolean, _
bolSize As Boolean
bolAreas = (rng1.Areas.Count = 1) Or (rng2.Areas.Count = 1)
bolSize = (rng1.Rows.Count = rng2.Rows.Count) And _
(rng1.Columns.Count = rng2.Columns.Count)
RangesOK = bolAreas And bolSize
End Function
+ DESDE JA AGRADEÇO A COLOBORAÇÃO DE TODOS
Postado : 19/03/2012 4:17 am