返回列表 上一主題 發帖

請問怎樣將不同色彩數目相加

請問怎樣將不同色彩數目相加


想問問有公式可以將不同色彩數字加起來嗎
(原表每月記錄房間使用次數繁多
所以不能簡單地將總數數出來
煩請各位幫忙
不勝感激)

http://blog.xuite.net/hcm19522/twblog/205029860

TOP

只分早、午、晚, 不分會議室A、B、C嗎?

TOP

http://blog.xuite.net/hcm19522/twblog/361275175

TOP

不知道 VBA 可不可以接受?
'注意:為了日期的可擴展性, 原 J1:J3 已移至 B16:B18
'請根據需要, 自行更改
Private Sub CommandButton1_Click()
    Dim Ar
    Dim R1 As Integer, C1 As Integer, LstC As Integer, CN As Integer
    Dim MC As Integer, AC As Integer, EC As Integer
   
    [B11:H13] = ""
    LstC = [IV2].End(xlToLeft).Column
    MC = [B16].Font.ColorIndex   '上午顏色
    AC = [B17].Font.ColorIndex   '下午顏色
    EC = [B18].Font.ColorIndex   '晩上顏色
   
    For R1 = 2 To 8
        For C1 = 2 To LstC
            If Cells(R1, C1) <> "" Then
                CN = Cells(R1, C1).Font.ColorIndex
                If CN = MC Then
                    Cells(11, C1) = Cells(11, C1) + Cells(R1, C1)
                ElseIf CN = AC Then
                    Cells(12, C1) = Cells(12, C1) + Cells(R1, C1)
                Else
                    Cells(13, C1) = Cells(13, C1) + Cells(R1, C1)
                End If
            End If
        Next
    Next
End Sub
test.gif

TOP

http://blog.xuite.net/hcm19522/twblog/205029860
hcm19522 發表於 2015-11-30 11:31

感謝
好像合用
不過還未弄清楚
要慢慢研究一下

TOP

只分早、午、晚, 不分會議室A、B、C嗎?
yen956 發表於 2015-11-30 13:59

是會議室A,B,C在上午,下午和晚上的使用次數

TOP

http://blog.xuite.net/hcm19522/twblog/361275175
hcm19522 發表於 2015-11-30 15:15

這個很有用
謝謝

TOP

回復 5# yen956
抱歉
我的Excel沒有"開發人員"這一項
所以用不到你提供的代碼

TOP

回復 9# K_Wing


    按 ALT-F11 就可以啟開
{...} 表示需要用 CTRL+SHIFT+ENTER 三鍵輸入公式

TOP

        靜思自在 : 口說一句好話,如口出蓮花;口說一句壞話如口吐毒蛇。
返回列表 上一主題