简体   繁体   English

如何在Excel中比较和突出显示一列中的字符串列表

[英]How to compare and highlight list of strings in one column with another column in excel

I have two columns A and B, Coulmn A has all the sentences and column B has verbs which are being used in sentences in column A. 我有两列A和B,Coulmn A具有所有句子,B列具有动词,这些动词正在A列的句子中使用。

I want to look for each verb of column B in column A, on a match I want verb to be highlighted in Column A. 我想在匹配项中查找A列中B列的每个动词,我希望该动词在A列中突出显示。

Its like looking for verbs one one by in all sentences of Coulmn A. 就像在Coulmn A的所有句子中一个一个地寻找动词一样。

Column A A栏

Summarize visualize and interpret data using tabular and graphical methods
Apply simple discrete probability models to analyze data related to quality such as particle size and ore concentration and to evaluate risk factors such as safety and environmental compliance
Formulate confidence intervals and hypothesis tests for the sample average and sample variance under standard conditions
Apply continuous probability models to assist in decision making with applications to quality improvement resource estimation safety and environmental compliance
Apply computer intensive methods to extend applications of statistical methods to nonstandard situations
Develop and analyze linear models to describe and predict process and laboratory behavior
Explain the phase rule and the fundamental concepts used in a phase diagram including critical state supercritical fluid phase transition and triple point
Describe the concept of a generalized equation of state and the laws of corresponding states to represent nonideal fluid behaviour
Acquire a deeper understanding of the Second Law of Thermodynamics that includes Carnots Theorem and the concept of entropy and its implications to process efficiency of unit operations such as pumps compressors turboexpanders and throttles
Calculate values of heat work enthalpy entropy and other thermodynamic properties and quantities Apply the concept of residual properties to calculate the efficiency of processes
Apply the fundamental concepts of thermodynamics to solving material energy and entropy balances for process components
Apply the combined material energy and entropy balance equations to solve process flow diagrams for basic power plants and refrigeration
Describe and analyze the performance the Rankine cycle the Brayton Cycles and other simple cycles Understand the concept of coefficient of performance
Demonstrate proficiency in operation and control of process and analytical equipment
Demonstrate engineering judgment and an awareness of the nature and magnitude of physical and chemical effects and factors as well as errors and uncertainties
Collect and interpret data to draw meaningful conclusions and evaluate the strengths weaknesses and limitations of current chemical engineering theory
Write concise coherent and grammatically correct lab reports that reflect critical analysis and synthesis Deliver clear and organized formal oral presentations
Demonstrate effective independent learning initiative originality and creativity in completion of prelab preparation and other tasks
Work effectively as group member and demonstrate good leadership skills when team leader adopting a professional approach during all project phases
Document and follow appropriate safety protocols
Draw and fully label a process flow diagram PFD for application of material and energy balances
Formulate and solve the material balance equations to analyze steadystate singleunit and multipleunit processes without reaction
Formulate and solve the material balance equations to analyze steadystate processes with reaction
Formulate and solve combined steadystate material and energy balances for chemical processes
Develop dynamic and steadystate models of chemical processes using mass balance energy balance and constitutive relationships
Calculate states inputs or parameters at steady states via solving relevant algebraic equations
Analyze process dynamics via solving relevant ordinary differential equations
Develop linearized models with deviation variables and assess the stability of process steady states via both eigenvalue analysis and Laplace transform of the linearized models
Solve complex algebraic and ordinary differential equations using MATLAB builtin functions and implement classical numerical methods on MATLAB
Calculate the pressure distribution in static fluids and the forces on submerged surfaces
Formulate mass momentum and energy balances using the control volume and differential analysis of fluid flow
Identify boundary conditions and solve differential equations describing onedimensional fluid flow
Determine frictional losses size pipes and calculate pump power requirements in laminar and turbulent flow for viscous flow in closed conduits
Calculate the drag forces on submerged objects in laminar and turbulent flow
Use dimensional analysis to derive relationships among process or system variables
Apply knowledge developed in steps   and  above to measure pressure and flow rates to estimate forces acting on pipes and joints and to size pumps and pipes Develop an understanding of the cost implications on developing a pumping process
Calculate centre of mass moment of inertia and volumes using multiple integrals to determine hydrostatic forces on surfaces
Analyze transport phenomena fundamentals forces in space moment of a force work done by a force and fluid kinematics displacement velocity and acceleration motion along a curve Define streamlines streaklines and pathlines Tools used include vectors in space dot product cross product areas and determinants in D volumes and determinants in D parametric representation of curves intersection of a line and a plane
Apply the integral relations for a control volume and the Reynolds transport theorem to analyze fluid motion
Analyze fluid motion using the differential analysis Velocity and acceleration fields linear and angular motion and deformation differential form of the continuity equation Cartesian and polar forms stream function potential function Associated mathematical framework vector fields divergence and curl
Formulate equations for heat and momentum transport using partial derivatives multivariable functions differentials the chain rule for multivariable functions directional derivatives
Development of mathematical skills i the mathematical formulation of engineering transport problems and corresponding analytical solution strategies ii Handling of differential operators in vector calculus and coordinate systems important for engineering applications
Identify and explain the major cellular processes in prokaryotes and eukaryotes
Describe the interrelationships between organisms and their environments
Identify and describe the relationship between structure and function on a molecular cellular and organismal level
Identify a range of fields where biological systems are being applied to solve engineering problems and discuss the most recent advances in each field as well as the strengths and limitations of each approach
Demonstrate laboratory skills and expertise with microbiological techniques
Recognize customer segments and develop value propositions and assess and develop markets for productsservices
Manage the development of a product and venture
Assess the viability of a project or venture using appropriate financial metrics eg NPV IRR EBITDA
Investigate problems and determine solutions using systems and design thinking approaches in both industrial and societal contexts
Explain a variety of advanced molecular and cellular biology techniques used for the characterization and manipulation of microorganisms with applications in medicine industry and the environment
Understand the  elements of a business model value propositions customer segments channels key resources key activities key partners cost structure revenue streams customer relationships identify these elements in existing ventures and differentiate between different contexts entrepreneurial versus intrapreneurial forprofit and notforprofit
Investigate existing intellectual property IP using appropriate tools summarize the competitive technology landscape and determine the appropriate manner for protecting intellectual property
Recognize societal needs in regards to products and services and develop a social license to operate
Identify and understand the principles of chemical equilibrium thermodynamics to solve multiphase equilibria and chemical reaction equilibria
Analyze the conditions associated with ideal and nonideal vapourliquid systems at equilibrium through the construction and interpretation of phase diagrams for ideal and nonideal binary mixtures
Use empirical correlations and experimental data to evaluate thermodynamic quantities that relate to the vapourliquid or liquidliquid equilibria of ideal and nonideal chemical mixtures
Determine equilibrium constants for chemical reactions and equilibrium point compositions for multiple reaction systems
Solve single and multistage separation processes involving nonideal chemical mixtures using numerical methods and simulations and recommend appropriate operating conditions
Demonstrate proficiency in operation and control of process and analytical equipment
Demonstrate engineering judgment and an awareness of the nature and magnitude of physical and chemical effects and factors as well as errors and uncertainties
Collect and interpret data to draw meaningful conclusions and evaluate the strengths weaknesses and limitations of current chemical engineering theory
Write concise coherent and grammatically correct lab reports that reflect critical analysis and synthesis Deliver clear and organized formal oral presentation
Demonstrate effective independent learning initiative originality and creativity in completion of prelab preparation and other tasks

Column B B栏

accept
access
acquire
act
adapt
adhere
analyze
apply
appraise
argue
arrange
ask
assemble
assess
assist
calculate
calibrate
carry out
categorize
choose
classify
co-ordinate
collaborate
collect
combine
commission
communicate
compare
complete
comply
compose
conduct
configure
conform
connect
consolidate
construct
contact
contrast
contribute
create
criticize
critique
debate
debug
decide
deduce
defend
define
deliver
demonstrate
describe
design
determine
develop
differentiate
discriminate
discuss
distinguish
do
document
dramatize
draw
eliminate
employ
engage
ensure
establish
estimate
evaluate
examine
execute
exercise
explain
experiment
express
extend
fabricate
find
follow
formulate
generalize
handle
hypothesize
identify
illustrate
implement
indicate
infer
inspect
install
integrate
interact
interpret
interrelate
invent
investigate
judge
keep
label
list
locate
maintain
make
make up
manage
manipulate
manufacture
match
memorize
modify
monitor
name
operate
omit
order
organize
originate
paint
paraphrase
participate
perform
plan
point out
practice
predict
prepare
prepare
prioritize
produce
program
promote
propose
quantify
question
rate
recall
recite
recognize
recommend
relate
repair
replace
report
represent
reproduce
research
respond
restate
review
rewrite
select
separate
service
set up
share
show
simulate
sketch
solve
source
specify
state
subdivide
summarize
support
survey
synthesize
take
tell
test
translate
troubleshoot
tune
understand
upgrade
use
utilize
validate
value
verify
weigh
work
write
Sub FindAndHighlight()
Const HighLightColor = vbRed 'choose colour here
Dim ws As Worksheet
Set ws = Worksheets("your sheet name here")
Dim Sentences As Range
Dim Verbs As Range
Set Sentences = Intersect(ws.UsedRange, ws.Columns("A"))
Set Verbs = Intersect(ws.UsedRange, ws.Columns("B"))
Dim s As Range
Dim v As Range
Dim x As Integer

For Each s In Sentences
    For Each v In Verbs
        x = InStr(s.Text, v.Text)
        If x > 0 Then
             s.Characters(x, Len(v.Text)).Font.Color = HighLightColor
        End If
    Next v
Next s
End Sub

I haven't got Excel here (I'm on my phone) so I may have syntax errors in this, but it should get you started 我在这里没有Excel(我在电话上),因此可能存在语法错误,但这应该可以帮助您入门

Or you could use Regular Expression: 或者您可以使用正则表达式:

Sub test()

Dim cellA As Range
Dim cellB As Range

For Each cellA In ActiveSheet.Columns("A").Cells
    If cellA <> vbNullString Then
        For Each cellB In ActiveSheet.Columns("B").Cells
            If cellB <> vbNullString Then
                Call RegEx_Extract(cellB.Value, cellA)
            End If
        Next cellB
    End If
Next cellA

End Sub

Sub RegEx_Extract(sPattern As String, rSearch As Range)

Set regEx = CreateObject("Vbscript.Regexp")
strToSearch = rSearch.Value
With regEx
.Global = True
.IgnoreCase = True
.Pattern = "\b" & sPattern & "\b"
'if you want to find mach inside other words just remove \b
Set regEx_Matches = .Execute(strToSearch)
End With

For Each itm In regEx_Matches

rSearch.Characters(itm.FirstIndex, Len(sPattern) + 1).Font.Color = vbRed

Next itm


End Sub

this should get the work done: 这应该完成工作:

Option Explicit

Sub Main()
    Dim word As Variant
    Dim verbs As Variant, verb As Variant
    Dim f As Range
    Dim firstAddress As String
    Dim pos As Long

    With Worksheets("mySheetName") ' reference your sheet "change "mySheetName" to your actual sheet name)
        verbs = Application.Transpose(.Range("B1", .Cells(.Rows.Count, 2).End(xlUp)).Value) ' store all verbs in an array
        With .Range("A1", .Cells(.Rows.Count, 1).End(xlUp)) ' reference referenced sheet column A cells from row 1 down to last not empty one
            For Each verb In verbs ' loop through each verb
                Set f = .Find(what:=verb, LookIn:=xlValues, lookat:=xlPart) ' try finding current verb occurrence in referenced range
                If Not f Is Nothing Then ' if found
                    firstAddress = f.Address ' store found cell address
                    Do
                        pos = 1 ' initialize "first" character index where to start formatting from
                        For Each word In Split(f.Text, " ") ' loop through current found cell text words
                            If UCase(word) = UCase(verb) Then f.Characters(pos, Len(verb)).Font.Color = vbRed ' if current word matches current verb, color word
                            pos = pos + Len(word) + 1 ' update "first" character index with the already processed word
                        Next
                        Set f = .FindNext(f) 'try finding current verb next occurrence in referenced range
                    Loop While f.Address <> firstAddress ' loop until you wrap back to the first found occurrence of the current verb in the referenced range
                End If
            Next
        End With
    End With
End Sub

you should notice: 您应该注意:

  • the use of Find() method to limit the number of loops through column A sentences to the ones that might (see subsequent note) actually contain the current verb 使用Find()方法将通过A列语句的循环数限制为实际上可能包含当前动词的循环数(请参阅后续说明)

  • the splitting of the processed sentence into an array ( For Each word In Split(f.Text, " ") ) to catch the occurrence of the current verb avoiding embedded occurrences (eg:" act " in "f act ors") and considering edge occurrences (if you searched for " summarize ", you wouldn't get it in "Summarize visualize and ...") 经处理的句子的划分到一个数组( For Each word In Split(f.Text, " ")来捕捉当前的动词避免嵌入出现(例如发生:’ 行为 ”中“F 动作 ORS”),并考虑边缘出现(如果搜索“ summary”,则不会在“ Summarize visualize and ...”中得到它)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果列值是另一张工作表中的值列表之一,则如何在Excel中突出显示特定行 - How to highlight specific row in Excel if column value is one of a list of value in another sheet 如何在excel中使用一列作为另一列中的搜索参数,以仅输出某些字符串 - How to use one column in excel as a search parameter in another column to output only certain strings 如果Excel中包含的单词位于另一列中,如何在Excel中突出显示单元格 - How to highlight a cell in Excel if the word it contains is in another column 如何在Excel中突出显示行和列 - how to highlight row & column in Excel Excel:将字符串列表与部分字符串列进行比较,如果匹配,则返回部分字符串 - Excel: Compare list of strings with a column of partial strings,if match then return the partial string VBA如何选择旁边的单元格为空时的值并将这些值与另一个工作表中的另一列进行比较并突出显示 - VBA How to select values when cell beside it is empty and compare those values with another column in another sheet and highlight 自动比较按列分组的行并突出显示 Excel 中的不同单元格 - Automatically compare rows grouped by a column and highlight different cells in Excel Excel:如何将数据从一列移动到另一列 - Excel: How to move data across from one column to another column Excel:如何将一列与另一列逐行添加? - Excel: How to add one column with another column, row by row? Excel-突出显示列中的差异 - Excel - highlight differences in column
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM