AW: Hallo Sepp, per Hand !
05.07.2015 13:03:38
Sepp
Hallo Kurt,
Farben zur Berechnung einzusetzen ist ganz schlechter Stil! Da handelst du dir nur Probleme ein.
Diese Funktion in ein allgemeines Modul:
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Public Function getColor(Target As Variant, Optional BackColor As Boolean = False, Optional ColorIndex As Boolean = True) As Variant
Dim vntI As Variant, vntOut() As Long, lngI As Long
On Error GoTo ErrExit
Application.Volatile
Redim vntOut(Target.Count - 1)
For Each vntI In Target
If BackColor Then
If ColorIndex Then
vntOut(lngI) = vntI.Interior.ColorIndex
Else
vntOut(lngI) = vntI.Interior.Color
End If
Else
If ColorIndex Then
vntOut(lngI) = vntI.Font.ColorIndex
Else
vntOut(lngI) = vntI.Font.Color
End If
End If
lngI = lngI + 1
Next
getColor = vntOut
Exit Function
ErrExit:
getColor = xlErrValue
End Function
Und so in der Tabelle verwenden:
Tabelle1
| | A | B | C | D | E | F |
| 1 | x | | | 3 | | |
| 2 | x | | | | | |
| 3 | x | | | | | |
| 4 | x | | | | | |
| 5 | x | | | | | |
| 6 | x | | | | | |
| 7 | x | | | | | |
| 8 | x | | | | | |
| 9 | | | | | | |
| 10 | | | | | | |
| Formeln der Tabelle |
| Zelle | Formel | | D1 | {=SUMME((getColor(A1:A8)=3)*1)} |
|
Enthält Matrixformel: Umrandende { } nicht miteingeben, sondern Formel mit STRG+SHIFT+RETURN abschließen! |
| Matrix verstehen |
Excel Tabellen im Web darstellen >> Excel Jeanie HTML 4
Du musst allerdings F9 drücken, wenn du die Farben änderst (ist nur einer der Nachteile).
Gruß Sepp