contar.si por codigo

23/06/2005 - 19:40 por Brel | Informe spam
Hola grupo,
intento usar varias funciones de excel por código en vez de asignarle
formula a una celda (rango de celdas) pero no lo consigo. Por ejemplo:
=SI(CONTAR.SI($B$6:B6;B6)-1=0;CONTAR.SI($B$6:$B$105;B6);"")
en b6:b102 (la mayoyia libres, o sea el rango es variable) hay fechas
de mas antigua a mas moderna y quiero contar cuantas veces se repiten
las fechas.
Gracias a todos -as.
Brel

Preguntas similare

Leer las respuestas

#6 Brel
25/06/2005 - 13:34 | Informe spam
Se le ocurre a alguien como?
"Brel" escribió en el mensaje
news:%
Chapeau, KL...
Intentar pasar a codigo las formulas que tenia en celdas (con rangos
variables) me esta dando mas de un quebradero de cabeza.
Ahora intento que en el Rango N sume el total cliente y me bloqueo con
SUMAPRODUCTO:
=SI(M10=1;D10;SI(M10<>"";SUMAPRODUCTO(($B$6:$B$105±0)*$D$6:$D$105);""))
Modificando tu codigo seria:
For w = 1 To e
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
If c.Offset(, 11).Value = 1 Then
c.Offset(, 12).Value = c.Offset(, 2).Value
ElseIf c.Offset(, 11).Value > 1 Then
c.Offset(, 12).Value =
End If
End With
Next w

Gracias anticipadas.
Brel
"KL" escribió en el mensaje
news:%
Hola otra vez,

version mas limpia:

Sub Test()
For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
End With
Next w
End Sub

Saludos,
KL



"KL" wrote in message
news:
Hola Brel,

Prueba esto:

For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 13).Offset(, -11)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), _
c), c) = 1, Application.CountIf(.Range("B6:B102"), c),
"")
End With
Next w

Saludos,
KL









Respuesta Responder a este mensaje
#7 KL
25/06/2005 - 13:35 | Informe spam
Hola Brel,

Otra manera menos complicada:

Sub Test()
For w = 1 To 98
With ActiveSheet
f = w + 5
miFormula = "=IF(M" & f & "=1,D" & f & _
",IF(M" & f & "<>"""",SUMPRODUCT(($B$6:$B$105=B" _
& f & ")*$D$6:$D$105),""""))"
.Cells(w + 5, "N").Formula = Evaluate(miFormula)
End With
Next w
End Sub

Saludos,
KL



"Brel" wrote in message
news:%
Chapeau, KL...
Intentar pasar a codigo las formulas que tenia en celdas (con rangos
variables) me esta dando mas de un quebradero de cabeza.
Ahora intento que en el Rango N sume el total cliente y me bloqueo con
SUMAPRODUCTO:
=SI(M10=1;D10;SI(M10<>"";SUMAPRODUCTO(($B$6:$B$105±0)*$D$6:$D$105);""))
Modificando tu codigo seria:
For w = 1 To e
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
If c.Offset(, 11).Value = 1 Then
c.Offset(, 12).Value = c.Offset(, 2).Value
ElseIf c.Offset(, 11).Value > 1 Then
c.Offset(, 12).Value =
End If
End With
Next w

Gracias anticipadas.
Brel
"KL" escribió en el mensaje
news:%
Hola otra vez,

version mas limpia:

Sub Test()
For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
End With
Next w
End Sub

Saludos,
KL



"KL" wrote in message
news:
Hola Brel,

Prueba esto:

For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 13).Offset(, -11)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), _
c), c) = 1, Application.CountIf(.Range("B6:B102"), c),
"")
End With
Next w

Saludos,
KL









Respuesta Responder a este mensaje
#8 Brel
25/06/2005 - 13:39 | Informe spam
Me adelante... gracias de nuevo, funciona perfecto KL.
Brel
"KL" escribió en el mensaje
news:Oa$
Hola Brel,

Otra manera menos complicada:

Sub Test()
For w = 1 To 98
With ActiveSheet
f = w + 5
miFormula = "=IF(M" & f & "=1,D" & f & _
",IF(M" & f & "<>"""",SUMPRODUCT(($B$6:$B$105=B" _
& f & ")*$D$6:$D$105),""""))"
.Cells(w + 5, "N").Formula = Evaluate(miFormula)
End With
Next w
End Sub

Saludos,
KL



"Brel" wrote in message
news:%
Chapeau, KL...
Intentar pasar a codigo las formulas que tenia en celdas (con rangos
variables) me esta dando mas de un quebradero de cabeza.
Ahora intento que en el Rango N sume el total cliente y me bloqueo con
SUMAPRODUCTO:
=SI(M10=1;D10;SI(M10<>"";SUMAPRODUCTO(($B$6:$B$105±0)*$D$6:$D$105);""))
Modificando tu codigo seria:
For w = 1 To e
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
If c.Offset(, 11).Value = 1 Then
c.Offset(, 12).Value = c.Offset(, 2).Value
ElseIf c.Offset(, 11).Value > 1 Then
c.Offset(, 12).Value =
End If
End With
Next w

Gracias anticipadas.
Brel
"KL" escribió en el mensaje
news:%
Hola otra vez,

version mas limpia:

Sub Test()
For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 2)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), c), c) = 1, _
Application.CountIf(.Range("B6:B102"), c), "")
End With
Next w
End Sub

Saludos,
KL



"KL" wrote in message
news:
Hola Brel,

Prueba esto:

For w = 1 To 98
With ActiveSheet
Set c = .Cells(w + 5, 13).Offset(, -11)
c.Offset(, 11).Value = _
IIf(Application.CountIf(Range(.Cells(6, 2), _
c), c) = 1, Application.CountIf(.Range("B6:B102"), c),
"")
End With
Next w

Saludos,
KL













email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una pregunta AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida