Condividi:        

analizzare le quote di un sistema

Vuoi potenziare i tuoi documenti Word? Non sai come si fa una macro in Excel? Devi creare una presentazione in PowerPoint?
Oppure sei passato a OpenOffice e non sei sicuro di come lavorare al meglio?

Moderatori: Anthony47, Flash30005

analizzare le quote di un sistema

Postdi raimea » 13/05/11 07:18

ciao a tutti
mi servirebbe un aiutino su come realizzare un "filtro" che mi analizzi le quote di un sistema,
ho provato con le formule a matrice ma mi diventa molto lento, forse con una macro e' piu accettabile.

ora vi descrivo:
1) nel fog 2-statistiche col BA cell 9 vorrei riportare i valori delle varie quote che ho usato in fogl 1 col. i,
2) poi in fogl 2 col BB cell 9 contare quante volte quella quota e' stata usata.
3)in fogl 2 col BC quante volte quella quota e' risultata vincente, verificando cio' in fogl 1 Col M.
4) in fogl 2 col BD quante volte quella quota e' risultata perdente, verificando cio' in fogl 1 Col M.

vi allego il file per una piu' facile comprensione
ciao a tutti

http://www.sendspace.com/file/dnir71
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Sponsor
 

Re: analizzare le quote di un sistema

Postdi Avatar3 » 13/05/11 17:58

Prova questa macro

Codice: Seleziona tutto
Sub Statistiche()
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim I As Integer: Dim J As Integer: Dim R As Integer
   
    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("I" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
    Ws2.Range("BA9:BD" & UR2).ClearContents
    For I = 9 To UR
            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 53) = Ws1.Cells(I, 9) Then
                Ws2.Cells(J, 54).Value = Ws2.Cells(J, 54).Value + 1
                GoTo saltaI
                Else
                If Ws2.Cells(J, 53).Value = 0 Then
                    Ws2.Cells(J, 53) = Ws1.Cells(I, 9)
                    Ws2.Cells(J, 54).Value = 1
                End If
                End If
            Next J
saltaI:
    Next I

            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BA" & J)
                For I = 9 To UR
                    If Q = Ws1.Cells(I, 9) Then
                        If UCase(Ws1.Cells(I, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(I, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next I
                Ws2.Range("BC" & J) = ContaV
                Ws2.Range("BD" & J) = ContaP
            Next J
End Sub

Ciao
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

analizzare le quote di un sistema

Postdi raimea » 13/05/11 23:43

:)
grandeeeee
proprio come la volevo funziona ed e' veloce.

x la "ciliegina sulla torta" :oops:
se in colonna BA fogl 2 volessi i valori in ordine crescente,
come potrei modificare la macro in modo che mi mette dal piu basso BA9 al piu alto ?

comunque gia cosi e' ottima,
grazie
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Avatar3 » 13/05/11 23:58

Ti potrei dare la soluzione....
Ma
prova a registrare una macro che faccia quell'ordinamento (selezionando l'intero range) e aggiungila alla mia macro prima dell'End Sub
sappi però che prima di registrare la macro non devi essere sul foglio 2_statistiche
ok?

ciao
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

Re: analizzare le quote di un sistema

Postdi raimea » 14/05/11 06:43

fatto
grazie al consiglio/suggerimento, ho capiyo come relaizzare la macro finale.
lavorando su fgl 1 prima metto in ord crescente COL I
poi eseguo la macro di avatar3
e alla fine riordino fogl 1 come in origine
riporto la macro finale

grazie.
Codice: Seleziona tutto
Sub analizquote()


Sheets("1-masa1-Fogl.Base").Select '1mo ordinmt fogl1 col I
    ActiveSheet.Unprotect
    Range("c9:W308").Select
    Selection.Sort Key1:=Range("I9"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("2-statistiche").Select


    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim I As Integer: Dim J As Integer: Dim R As Integer
   
    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("I" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
    Ws2.Range("BA9:BD" & UR2).ClearContents
    For I = 9 To UR
            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 53) = Ws1.Cells(I, 9) Then
                Ws2.Cells(J, 54).Value = Ws2.Cells(J, 54).Value + 1
                GoTo saltaI
                Else
                If Ws2.Cells(J, 53).Value = 0 Then
                    Ws2.Cells(J, 53) = Ws1.Cells(I, 9)
                    Ws2.Cells(J, 54).Value = 1
                End If
                End If
            Next J
saltaI:
    Next I

            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BA" & J)
                For I = 9 To UR
                    If Q = Ws1.Cells(I, 9) Then
                        If UCase(Ws1.Cells(I, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(I, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next I
                Ws2.Range("BC" & J) = ContaV
                Ws2.Range("BD" & J) = ContaP
            Next J


Sheets("1-masa1-Fogl.Base").Select '2do ordinmt riordino fogl 1
Range("C9:W308").Select
    Selection.Sort Key1:=Range("C9"), Order1:=xlAscending, Key2:=Range("E9") _
        , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
        False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
        :=xlSortTextAsNumbers
    Sheets("2-statistiche").Select

End Sub
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Avatar3 » 14/05/11 09:12

Beh io dicevo di registrare la macro stando su un altro foglio in maniera che rendendo attivo il foglio 2_Statistiche
la macro registrava la select di questo foglio nel quale poi avresti ordinato solo la tabella risultante
senza modificari i dati del foglio base (1)

Replico l'intera macro in quanto ho aggiunto anche i codici per fermare il calcolo automatico e ciò rende tutto molto più veloce l'esecuzione
Codice: Seleziona tutto
Sub Statistiche()
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim I As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("I" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
    Ws2.Range("BA9:BD" & UR2).ClearContents
    For I = 9 To UR
            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 53) = Ws1.Cells(I, 9) Then
                Ws2.Cells(J, 54).Value = Ws2.Cells(J, 54).Value + 1
                GoTo saltaI
                Else
                If Ws2.Cells(J, 53).Value = 0 Then
                    Ws2.Cells(J, 53) = Ws1.Cells(I, 9)
                    Ws2.Cells(J, 54).Value = 1
                End If
                End If
            Next J
saltaI:
    Next I

            UR2 = Ws2.Range("BA" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BA" & J)
                For I = 9 To UR
                    If Q = Ws1.Cells(I, 9) Then
                        If UCase(Ws1.Cells(I, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(I, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next I
                Ws2.Range("BC" & J) = ContaV
                Ws2.Range("BD" & J) = ContaP
            Next J
           
           
             Sheets("2-statistiche").Select
    Range("BA9:BD26").Select
    Selection.Sort Key1:=Range("BA9"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub



Ciao
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

analizzare le quote di un sistema

Postdi raimea » 14/05/11 15:43

:o
grazie 1000 avatar
la macro e' un missile, io non sarei stato in grado di realizzarla,come avrai capito sono ancora a LIV 1 in VBA :P
xro l'impegno sul tuo consiglio ce lo messo

di nuovo grazie.
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

analizzare le quote di un sistema

Postdi raimea » 14/05/11 15:43

:o
grazie 1000 avatar
la macro e' un missile, io non sarei stato in grado di realizzarla,come avrai capito sono ancora a LIV 1 in VBA :P
xro l'impegno sul tuo consiglio ce lo messo

di nuovo grazie.
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi raimea » 15/05/11 12:16

:roll: aiutino.... :?:
ho tentato di adattare la macro di avatar in modo di
ottenere lo stesso tipo di - analisi - sugli orari
cioe' fogl 1 col E
ma qualcosa non mi torna.....
vorrei filtrare gli orari di col E fogl 1, riportrli in fogl 2 col BI e relativi conteggi
come per le quote ma non mi funge come vorrei...

questa la macro che ho scritto:
Codice: Seleziona tutto
Sub analizzaorari()

UserForm2.Show vbModeless
DoEvents
Inizio = Timer

    ActiveSheet.Unprotect
   
   
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim E As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("E" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
    Ws2.Range("BI9:BL" & UR2).ClearContents
    For E = 9 To UR
            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 61) = Ws1.Cells(E, 9) Then
                Ws2.Cells(J, 62).Value = Ws2.Cells(J, 62).Value + 1
                GoTo saltaE
                Else
                If Ws2.Cells(J, 61).Value = 0 Then
                    Ws2.Cells(J, 61) = Ws1.Cells(E, 9)
                    Ws2.Cells(J, 62).Value = 1
                End If
                End If
            Next J
saltaE:
    Next E

            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BI" & J)
                For E = 9 To UR
                    If Q = Ws1.Cells(E, 9) Then
                        If UCase(Ws1.Cells(E, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(E, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next E
                Ws2.Range("BK" & J) = ContaV
                Ws2.Range("BL" & J) = ContaP
            Next J
           
           
             Sheets("2-statistiche").Select
    Range("BI9:BL50").Select
    Selection.Sort Key1:=Range("BI9"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

ActiveWindow.ScrollRow = 1  ' alza la barra later dx

Unload UserForm2
      Fine = Timer
MsgBox ("Tempo impiegato " & Int((Fine - Inizio) / 60) & " min " & (Fine - Inizio) Mod 60 & " Sec")

End Sub


cosa devo modific perche' tutto faccia riferimento a col E di fogl 1 ?



http://www.sendspace.com/file/ff283m
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi raimea » 15/05/11 18:28

:D
dopo 8.743 tentativi... BINGO....
finalmente sono riuscito a trovare le necessarie modifiche
riporto la macro finale
Codice: Seleziona tutto
Sub analizzaorari()

UserForm2.Show vbModeless
DoEvents
Inizio = Timer

    ActiveSheet.Unprotect
   
   
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim E As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("E" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
    Ws2.Range("BI9:BL" & UR2).ClearContents
    For E = 9 To UR
            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 61) = Ws1.Cells(E, 5) Then
                Ws2.Cells(J, 62).Value = Ws2.Cells(J, 62).Value + 1
                GoTo saltaE
                Else
                If Ws2.Cells(J, 61).Value = 0 Then
                    Ws2.Cells(J, 61) = Ws1.Cells(E, 5)
                    Ws2.Cells(J, 62).Value = 1
                End If
                End If
            Next J
saltaE:
    Next E

            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BI" & J)
                For E = 5 To UR
                    If Q = Ws1.Cells(E, 5) Then
                        If UCase(Ws1.Cells(E, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(E, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next E
                Ws2.Range("BK" & J) = ContaV
                Ws2.Range("BL" & J) = ContaP
            Next J
           
           
             Sheets("2-statistiche").Select
    Range("BI9:BL50").Select
    Selection.Sort Key1:=Range("BI9"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

ActiveWindow.ScrollRow = 1  ' alza la barra later dx

Unload UserForm2
      Fine = Timer
MsgBox ("Tempo impiegato " & Int((Fine - Inizio) / 60) & " min " & (Fine - Inizio) Mod 60 & " Sec")

End Sub
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Avatar3 » 15/05/11 18:31

La macro era stata adattata abbastanza bene ma dovevi correggere il riferimento di controllo su Foglio1
Codice: Seleziona tutto
Ws1.Cells(E, 9)

come vedi qui hai lasciato la colonna 9 che corrisponde a "I" e non a "E" avresti dovuto mettere
Codice: Seleziona tutto
Ws1.Cells(E, 5)

(in un paio di punti)


La invio completa e corretta

Codice: Seleziona tutto
Sub analizzaorari()

UserForm2.Show vbModeless
DoEvents
Inizio = Timer

    ActiveSheet.Unprotect
   
   
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim E As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("E" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
    Ws2.Range("BI9:BL" & UR2).ClearContents
    For E = 9 To UR
            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 61) = Ws1.Cells(E, 5) Then
                Ws2.Cells(J, 62).Value = Ws2.Cells(J, 62).Value + 1
                GoTo saltaE
                Else
                If Ws2.Cells(J, 61).Value = 0 Then
                    Ws2.Cells(J, 61) = Ws1.Cells(E, 5)
                    Ws2.Cells(J, 62).Value = 1
                End If
                End If
            Next J
saltaE:
    Next E

            UR2 = Ws2.Range("BI" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("BI" & J)
                For E = 9 To UR
                    If Q = Ws1.Cells(E, 5) Then
                        If UCase(Ws1.Cells(E, 13)) = "V" Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(E, 13)) = "P" Then ContaP = ContaP + 1
                    End If
                Next E
                Ws2.Range("BK" & J) = ContaV
                Ws2.Range("BL" & J) = ContaP
            Next J
           
           
             Sheets("2-statistiche").Select
    Range("BI9:BL50").Select
    Selection.Sort Key1:=Range("BI9"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

ActiveWindow.ScrollRow = 1  ' alza la barra later dx

Unload UserForm2
      Fine = Timer
MsgBox ("Tempo impiegato " & Int((Fine - Inizio) / 60) & " min " & (Fine - Inizio) Mod 60 & " Sec")

End Sub


Ciao

Edit: ho visto solo ora che hai corretto da solo ;)
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

Re: analizzare le quote di un sistema

Postdi raimea » 15/05/11 19:55

:D GRAZIE per la disponibilita' e la bella spiegazione
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi raimea » 22/05/11 08:17

grazie alla macro di avatar sono riuscito a realizzare altre tabelle, ma questa " non mi esce... " :?:
provo a spiegare:
dovrei riuscire a filtrare quante "f" in col w fogl 1, hanno in col S il num 1, 2 oppure 3 ecc...
e contemporanmte rilevare se la relativa cella in col T e' magg/ min di zero

Es: 1 sola "f" ha il num 6 ed e' positivo
il tutto riportarlo in fgl 2 da col CG

io riporto sotto la macro che ho fatto ma ......
Codice: Seleziona tutto
Sub analizzamasanl()
UserForm2.Show vbModeless
DoEvents
Inizio = Timer

    ActiveSheet.Unprotect
   
   
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim S As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("S" & Rows.Count).End(xlUp).Row
    UR2 = Ws2.Range("CG" & Rows.Count).End(xlUp).Row
    Ws2.Range("CG9:CJ" & UR2).ClearContents
    For S = 9 To UR
            UR2 = Ws2.Range("CG" & Rows.Count).End(xlUp).Row + 1
            If UR2 < 9 Then UR2 = 9
            For J = 9 To UR2
                If Ws2.Cells(J, 85) = Ws1.Cells(S, 19) Then
                Ws2.Cells(J, 86).Value = Ws2.Cells(J, 86).Value + 1
                GoTo saltaS
                Else
                If Ws2.Cells(J, 85).Value = 0 Then
                    Ws2.Cells(J, 85) = Ws1.Cells(S, 19)
                    Ws2.Cells(J, 86).Value = 1
                End If
                End If
            Next J
saltaS:
    Next S

            UR2 = Ws2.Range("CG" & Rows.Count).End(xlUp).Row
            For J = 9 To UR2
            ContaV = 0
            ContaP = 0
            Q = Ws2.Range("CG" & J)
                For S = 19 To UR
                    If Q = Ws1.Cells(S, 19) Then
                        If UCase(Ws1.Cells(S, 20)) >= 0 Then ContaV = ContaV + 1
                        If UCase(Ws1.Cells(S, 20)) >= 0 Then ContaP = ContaP + 1
                    End If
                Next S
                Ws2.Range("CI" & J) = ContaV
                Ws2.Range("CJ" & J) = ContaP
            Next J
           
           
             Sheets("2-statistiche").Select
    Range("CG9:CJ58").Select
    Selection.Sort Key1:=Range("CG9"), Order1:=xlAscending, Header:=xlNo, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

ActiveWindow.ScrollRow = 1  ' alza la barra later dx

ActiveWindow.DisplayGridlines = False
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFormattingColumns:=True, AllowFormattingRows:=True
    Range("CC2").Select

Unload UserForm2
      Fine = Timer
MsgBox ("Tempo impiegato " & Int((Fine - Inizio) / 60) & " min " & (Fine - Inizio) Mod 60 & " Sec")


    Range("CF2").Select
End Sub


allego anche il file

http://www.sendspace.com/file/iivw4w
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Anthony47 » 22/05/11 12:18

In CH9 di foglio "2-statistiche" usi la formula
Codice: Seleziona tutto
=MATR.SOMMA.PRODOTTO(--('1-masa1-Fogl.Base'!$W$9:$W$1000="f");--('1-masa1-Fogl.Base'!$S$9:$S$1000=$CG9))

Poi copi verso il basso
Per le colonne CI e CJ aggiungerai una ulteriore matrice del tipo
Codice: Seleziona tutto
--('1-masa1-Fogl.Base'!$T$9:$T$1000>=0)
oppure
Codice: Seleziona tutto
--('1-masa1-Fogl.Base'!$T$9:$T$1000<0)


Invece del "1000" puoi usare un valore piu' basso, purche' certamente superiore al max numero di righe che hai.

Ciao
Avatar utente
Anthony47
Moderatore
 
Post: 19196
Iscritto il: 21/03/06 16:03
Località: Ivrea

analizzare le quote di un sistema

Postdi raimea » 22/05/11 12:40

:lol:
GRANDEeeeeeee
tutto ok,
e senza bisogno della macro.
grazie
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

analizzare le quote di un sistema

Postdi raimea » 26/05/11 06:30

buon giorno a tutti
sempre dello stesso file... , (le statistiche non finiscono mai... :eeh: ),
vorrei poter contare il ritardo dei singoli segni 1,X,2.
nel fgl 1 COL P vorrei poter contare il ritardo attuale dei 3 singoli segni 1,x,2
per fare cio' si dovrebbe rilevare l'ultima sua uscita e contare in avanti, fino all'ultima partita terminata.
ES.
in questo file il segno 1 ha 0
il segno 2 e' in ritardo di 3
il segno X e' in ritrardo di 1,
questi 3 valori da rilevare li vorrei poter scrivere in fogl 2 COL CP da riga 9 :undecided:
vi ringrazio sempre x l'attenzione e la professionalita' di tutti.
ciao
allego il file

http://www.sendspace.com/file/z2h00l
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Avatar3 » 26/05/11 10:35

Puoi risolvere con una macro inserita in un modulo che attiverai ad ogni attivazione del foglio statistiche (con la call alla macro)
Codice: Seleziona tutto
Sub Ritardi1x2()
    Dim Ws1 As Worksheet
    Dim Ws2 As Worksheet
    Dim E As Integer: Dim J As Integer: Dim R As Integer

Application.ScreenUpdating = False
Application.Calculation = xlManual

    Set Ws1 = Sheets("1-masa1-Fogl.Base")
    Set Ws2 = Sheets("2-statistiche")
    UR = Ws1.Range("P" & Rows.Count).End(xlUp).Row
For RR = UR To 9 Step -1
If Ws1.Range("P" & RR).Value <> "" Then
URE = RR
GoTo salta
End If
Next RR
salta:
ContaR = 0
Ws2.Range("CP9:CP11").ClearContents
For RR = URE To 9 Step -1
If Ws2.Range("CP9").Value = "" And Ws1.Range("P" & RR).Value = 1 Then Ws2.Range("CP9").Value = ContaR
If Ws2.Range("CP10").Value = "" And UCase(Ws1.Range("P" & RR).Value) = "X" Then Ws2.Range("CP10").Value = ContaR
If Ws2.Range("CP11").Value = "" And Ws1.Range("P" & RR).Value = "2" Then Ws2.Range("CP11").Value = ContaR
ContaR = ContaR + 1
Next RR
    Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

Re: analizzare le quote di un sistema

Postdi raimea » 26/05/11 16:48

:P ottimo....tutto ok
grande avatar, stai dando un grande contributo al forum con le tue conoscenze in vba,
e con la pazienza, che stai dimostrando.
inoltre aiuti molto i Sig flash e Sig antony.
grazie
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Re: analizzare le quote di un sistema

Postdi Avatar3 » 27/05/11 00:20

Mi fa piacere che ciò che ho realizzato ha soddisfatto la tua esigenza
A questo forum io devo molto...
ho imparato ad usare excel e access leggendo e provando le soluzioni fornite da
Anthony, Flash, Ricky, Archimede, Pc_Base e tanti altri che ora mi sfuggono e, mi scuso con loro, che danno un contributo,
quindi qui ho "preso" e metto a disposizione ciò che ora "ho" entro i limiti delle mie possibilità
Credo che se le persone pensano solo a prendere senza voler dare la Società (in genere) vada in declino.

Grazie per i complimenti ;)
Per il funzionamento delle macro si deve impostare la protezione a Bassa o Media.
Menu Strumenti -> Macro -> Protezione...
Avatar utente
Avatar3
Utente Senior
 
Post: 569
Iscritto il: 04/04/11 09:04

analizzare le quote di un sistema

Postdi raimea » 28/05/11 12:23

altra statistica.. :undecided:
sempre dalla col P del fogl 1, vorrei poter riportare il MASSIMO ritardo che ogni
segno, 1,x,2, ha avuto,
Es. per il seg 2 suo il MAX ritardo e' stato di 15 giocate prima che si ripetesse.
tale dato lo vorrei riportare in fogl 2 COL CP da cella CP15. :!:

vi allego il file
http://www.sendspace.com/file/lnkg88
grazie
S.O. win10, Excell 2019
Avatar utente
raimea
Utente Senior
 
Post: 1410
Iscritto il: 11/02/10 07:33
Località: lago

Prossimo

Torna a Applicazioni Office Windows


Topic correlati a "analizzare le quote di un sistema":


Chi c’è in linea

Visitano il forum: Nessuno e 61 ospiti