Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

excel - 在excel或VBA上不满足条件时,如何创建循环并移至下面的单元格?(How to create a loop and move to the cell below when a condition is not met on excel or VBA?)

I have a list of keywords and a list of questions on excel.

(我有一个关键字列表和一个关于Excel的问题列表。)

I need to see IF every single keywords is found into the questions or not.

(我需要查看是否在问题中找到每个关键字。)

eg

(例如)

       A                    B
   1 expense      how is my bonus calculated?
   2 business     how do i change my bank account? 
   3 bonus        how do i apply for a credit card?

I was trying to solve it with an IF statement on excel such as:

(我试图用excel上的IF语句来解决它,例如:)

=IF(ISNUMBER(SEARCH(A1,B1)),A1,IF(ISNUMBER(SEARCH(A2,B1)),A2,IF(ISNUMBER(SEARCH(A3,B1)),A3,"no")))

but it works just for few keywords, so I was wondering if there is an alternative way as a formula or maybe an easy method on VBA to create a loop.

(但是它仅适用于少数关键字,因此我想知道是否可以使用替代方法作为公式或在VBA上创建循环的简便方法。)

In other words: IF A1 is NOT on B1, look at A2, if not, look at A3, etc.

(换句话说:如果A1不在B1上,请查看A2,否则,请查看A3,依此类推。)

Thanks a lot to everyone will help!

(非常感谢大家,将为您提供帮助!)

  ask by mrpls translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Please try this formula.

(请尝试此公式。)

=IFERROR(INDEX(Texts,MATCH("*" & A1 & "*",Texts,0)),"No found")

To make this formula work you should create a named range for your texts.

(要使此公式起作用,您应该为文本创建一个命名范围。)

I called it "Texts".

(我称它为“文本”。)

You should also write the key word you wish to look up in cell A1 (change as appropriate).

(您还应该在单元格A1中写入要查找的关键字(适当更改)。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...