[英]EXCEL: Check if cell text is found in another column
I have a set of 6500 school courses that I need to "normalize" and the process is to take the exact code (ex: 23.XX510XXX) if that number is contained in a set of defined "rigorous courses" or if it is AP. 我有一组6500所学校课程,我需要对其进行“规范化”,如果该数字包含在一组已定义的“严格课程”中,或者是AP,则过程将采用确切的代码(例如:23.XX510XXX) 。 So the algorithm is like this:
所以算法是这样的:
if x is contained within X:
then x=x
else if PSO=0:
then x=23
else if (#Observed/PSO) >.5
then x=x
else x=23
But I'm not sure how to do this in excel. 但是我不确定如何在excel中做到这一点。 I tried this:
我尝试了这个:
=IF(ISERROR(VLOOKUP(C2,$L$1:$L$28,0,FALSE)),23,IF(F2=0,23,IF(G2/F2>0.5,C2,23))) = IF(ISERROR(VLOOKUP(C2,$ L $ 1:$ L $ 28,0,FALSE)),23,IF(F2 = 0,23,IF(G2 / F2> 0.5,C2,23)))
But it only returns 23 every time. 但每次仅返回23。 The way it is set up, is column C is the non-normalized number that I check against column L. Column F is the PSO indicator and column G is the #observed.
它的设置方式是C列是我对照L列检查的非标准化数字。F列是PSO指示器,G列是#observed。
The PSO and #observed is because we are willing to accept the course overall as rigorous if it was taken as AP more than 50% of the time. PSO和#observed是因为,如果超过50%的时间被选为AP,我们愿意接受该课程的严格要求。
Does anyone see where I went wrong? 有人看到我错了吗?
If anyone can explain how to do it in VBA (not just give me the code) I'd love you forever!! 如果有人可以在VBA中解释如何做(不仅给我代码),我将永远爱你!
That looks almost right but the VLOOKUP
will always return an error because your "Column Index" is zero, where it should be 1 - try like this 看起来几乎是正确的,但是
VLOOKUP
总是会返回错误,因为您的“列索引”为零,应该为1,请尝试以下操作
=IF(ISERROR(VLOOKUP(C2,$L$1:$L$28,1,FALSE)),23,IF(F2=0,23,IF(G2/F2>0.5,C2,23)))
.....or my preference is for COUNTIF like this .....或我的首选是这样的COUNTIF
=IF(COUNTIF($L$1:$L$28,C2)=0,23,IF(F2=0,23,IF(G2/F2>0.5,C2,23)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.