Come si puň fare tutto questo con Excel ?
Grazie.
prova questa
=Unix(valori)
dove
Public Function Unix(rng As Range) As Long
Dim unici As New Collection
On Error Resume Next
For Each x In rng
unici.Add x, x.Text
Next x
unix = unici.Count
End Function
forse si puň migliorare.
.f
Nome provocatorio? :-)
> dove
> Public Function Unix(rng As Range) As Long
> Dim unici As New Collection
> On Error Resume Next
> For Each x In rng
> unici.Add x, x.Text
> Next x
> unix = unici.Count
> End Function
> forse si puň migliorare.
Dato che val sempre la pena complicarsi la vita per un nobile scopo...
Option Explicit
Public Function Unix( _
ByVal RangeInput As Excel.Range _
, Optional ByVal ContaVuote As Boolean = False _
) As Variant
On Error GoTo Err
Dim colElementi As Collection
Dim lngIndex As Long
Dim lngMaxRow As Long
Dim lngMaxCol As Long
Application.Volatile True
Set colElementi = New Collection
With RangeInput.Cells
With .Parent.UsedRange
lngMaxRow = .Rows.Count
lngMaxCol = .Columns.Count
End With
For lngIndex = 1 To .Count
If _
.Item(lngIndex).Row <= lngMaxRow And _
.Item(lngIndex).Column <= lngMaxCol Then
If Len(.Item(lngIndex)) > 0 Or ContaVuote Then
On Error Resume Next
colElementi.Add Item:="", Key:="K" & .Item(lngIndex)
On Error GoTo Err
End If
Else
Exit For
End If
Next
End With
Unix = colElementi.Count
Ext:
Set colElementi = Nothing
Exit Function
Err:
Unix = CVErr(Err.Number)
Resume Ext
End Function
Da testare!...
--
Ciao.
Maurizio
--------
?SPQR(C)
X
--------
Ciao,
Mark
"iiiii" <i...@ii.ii> ha scritto nel messaggio
news:dSUH6.26101$0t6.1...@news.infostrada.it...
> Come si possono contare dei valori unici in Excel ? Mi spiego meglio:
> In una colonna ho i seguenti valori: A - B - C - A - B - B - D - C - C
> I valori "unici" sono A - B - C - D perchè il resto sono delle
ripetizioni.
> Il valore quindi che dovrebbe restituirmi la formula che Vi chiedo è: 4.
>
> Come si può fare tutto questo con Excel ?
>
> Grazie.
>
>
>
>
>
>