2011-07-27 18:10:11 +0000 2011-07-27 18:10:11 +0000
23
23
Advertisement

基于文本值的颜色单元格

Advertisement

一个Excel列包含一个文本值,代表该行的类别。

有没有一种方法可以将所有具有独特值的单元格格式化为唯一的颜色,而不需要手动为每个值创建一个条件格式?

例子。如果我的类别是bedroom, bedroom, bathroom, kitchen, living room,我希望所有包含bedroom的单元格都是特定的颜色,bathroom是不同的颜色等等。

Advertisement
Advertisement

答案 (4)

11
11
11
2011-07-27 19:55:10 +0000

以下是Excel 2010的截图,但在2007年应该是一样的。

选择单元格,然后进入Conditional Formatting | Highlight Cells Rules | Text that Contains

更新:要对整个工作表应用条件格式化,请选择所有单元格,然后应用条件格式化。

6
6
6
2015-07-24 17:27:34 +0000
  1. 将您要格式化的列复制到一个空工作表中。选择该列,然后从功能区的 “数据 "选项卡上的 "数据工具 "面板中选择 "删除重复"。
  2. 在你唯一的值或字符串列表的右边,做一个唯一的数字列表。例如,如果你有6个类别要着色,那么第二列可以只是1-6。这就是你的查找表。 4.在新列中,使用VLOOKUP将文本字符串映射到新的颜色。
2
Advertisement
2
2
2016-09-02 07:37:04 +0000
Advertisement

发件人: http://www.mrexcel.com/forum/excel-questions/861678-highlighting-rows-random-colors-if-there-duplicates-one-column.html#post4185738

Sub ColourDuplicates()
Dim Rng As Range
Dim Cel As Range
Dim Cel2 As Range
Dim Colour As Long

Set Rng = Worksheets("Sheet1").Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
Rng.Interior.ColorIndex = xlNone
Colour = 6
For Each Cel In Rng

If WorksheetFunction.CountIf(Rng, Cel) > 1 And Cel.Interior.ColorIndex = xlNone Then
Set Cel2 = Rng.Find(Cel.Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False, SearchDirection:=xlNext)
    If Not Cel2 Is Nothing Then
        Firstaddress = Cel2.Address
        Do
        Cel.Interior.ColorIndex = Colour
        Cel2.Interior.ColorIndex = Colour
            Set Cel2 = Rng.FindNext(Cel2)

        Loop While Firstaddress <> Cel2.Address
    End If

Colour = Colour + 1

End If
Next

End Sub
1
1
1
2015-07-07 17:46:29 +0000

条件格式化中的自动颜色选择功能并不是Microsoft Excel的一个功能。

但是,你可以根据类别列的值单独给整个行上色。在 “条件格式化 "中创建一个新的格式化规则。 2. 使用一个公式来确定要格式化哪些单元格。 3. 公式:=$B1="bedroom"(假设类别列为B) 4. 设置格式(使用填充色) 5.将规则格式化应用到所有单元格。

Advertisement

相关问题

6
13
9
10
3
Advertisement