Moderatori: Anthony47, Flash30005
Ma chi mette gli 1 e gli 0? Che se fossero invece, ad esempio, 0, 0, .. (invece che 1) e 1, 2, 3, 4, ... (invece che 0) sarebbe molto piu' semplice.Vanno create le somme per ogni riga che ha valore 0 e per quella immediatamente precedente con valore 1
Anthony47 ha scritto:Quel che chiedi si fa, su 50mila righe, in meno di 1 secondo di elaborazione.
Pero' serve una versione piu' attendibile del file, senza nessuna elaborazione preliminare...
klingklang ha scritto:Prova con
=SE(a2<>a1;0;a1+1)
In realtà, anche senza colonna di appoggio, basterebbe un SOMMA.PIÙ.SE sulle 4 colonne chiave e con un'unica formula avresti risolto.
karug64 ha scritto:klingklang ha scritto:Prova con
=SE(a2<>a1;0;a1+1)
In realtà, anche senza colonna di appoggio, basterebbe un SOMMA.PIÙ.SE sulle 4 colonne chiave e con un'unica formula avresti risolto.
Saresti così gentile da farmi vedere come? Grazie
Sub NonSoChe()
Dim shP As Worksheet, cPil As String, WArr, LastCP As Long
Dim oArr(), LB0, FI As Long, I As Long, myTim As Single
'
cPil = "A" '<<< La colonna con gli 1/0
'Set shP = ThisWorkbook.Sheets("Foglio1") '*** Il Foglio di lavoro
Set shP = ActiveSheet '*** Alternativa alla istruz precedente
'
myTim = Timer
LastCP = shP.Cells(Rows.Count, cPil).End(xlUp).Row
WArr = shP.Cells(1, cPil).Resize(LastCP + 1, 5).Value
LB0 = LBound(WArr)
ReDim oArr(LB0 To UBound(WArr), 1 To 2)
For I = LBound(WArr) + 1 To UBound(WArr) - 1
If WArr(I + 1, LB0) = 0 Or (WArr(I + 1, LB0) = 1 And FI > 0) Then
If FI = 0 Then FI = I - 1
oArr(FI, 1) = oArr(FI, 1) + WArr(I, LB0 + 3)
oArr(FI, 2) = oArr(FI, 2) + WArr(I, LB0 + 4)
If WArr(I + 1, LB0) = 1 Then FI = 0
End If
Next I
shP.Cells(2, cPil).Offset(0, 1).Resize(LastCP, 2) = oArr
MsgBox ("Completato, sec: " & Format(Timer - myTim, "0.00"))
End Sub
klingklang ha scritto:karug64 ha scritto:klingklang ha scritto:Prova con
=SE(a2<>a1;0;a1+1)
In realtà, anche senza colonna di appoggio, basterebbe un SOMMA.PIÙ.SE sulle 4 colonne chiave e con un'unica formula avresti risolto.
Saresti così gentile da farmi vedere come? Grazie
Se ad esempio le 4 colonne chiave sono A:D e la colonna da sommare è la E:
=SOMMA.PIÙ.SE($E$1:$E$50000;$A$1:$A$50000;A1;$B$1:$B$50000;B1;$C$1:$C$50000;C1;$D$1:$D$50000;D1)
Torna a Applicazioni Office Windows
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
confrontare e evidenziare 2 fogli excel Autore: niccia |
Forum: Applicazioni Office Windows Risposte: 7 |
Visitano il forum: Nessuno e 16 ospiti