在Excel中:如何多次突出显示具有特定字符的单元格

在Excel中,以下列表值在列A中

research.med.helsinki.fi fixus.fi fixusnet.fi toolpack.fi porinteatteri.fi lippu.fi ensemble.fi autoarvio.fi ratti.autoarvio.fi adwords.google.com fram.fi edriver.fram.fi alajarvi.perussuomalaiset.fi per.us.su.omalaiset.fi 

A列中有更多类似的值

我会想要突出显示所有具有点字符(。)的值多次,它可以是一个vbamacros或公式

运行macros/公式后,应突出显示以下值:

 research.med.helsinki.fi ratti.autoarvio.fi adwords.google.com edriver.fram.fi alajarvi.perussuomalaiset.fi per.us.su.omalaiset.fi 

感谢Ziv

你可以使用基于公式的条件格式,所以len(a1)-substitute(a1,".","")>=2

假设您的数据从单元格A2开始

运行下面的代码。 它将突出显示包含多于1个点的数据(在列A中)。

 Sub highlight() Dim lastrow As Long, i As Long lastrow = Range("A" & Rows.Count).End(xlUp).Row For i = 2 To lastrow If (Len(Range("A" & i).Value) - Len(WorksheetFunction.Substitute(Range("A" & i).Value, ".", "")) > 1) Then Range("A" & i).Interior.ColorIndex = 4 End If Next i End Sub 

在这里输入图像说明