简体   繁体   English

Excel VBA /公式搜索列

[英]Excel VBA/Formula to search Column

I need to search a column for 5-9 digit ID's that follow the term ^v_cusip= and are separated by commas. 我需要在一列中搜索5-9位数字ID,该ID后接术语^v_cusip= ,并用逗号分隔。 From first glance it seemed that the ID's were followed by ^v_sort_order so I tried: 乍一看,ID后面跟着^v_sort_order所以我尝试了:

=MID(A2,FIND("^v_cusip=",A2)+9,(FIND("^v_sort_order=",A2)-(FIND("^v_cusip=",A2)+9)))

However, what follows ^v_cusip= varies. 但是, ^v_cusip=有所不同。 Is there another formula or a VBA code I can use to search the rows? 我可以使用其他公式或VBA代码搜索行吗? I cannot repeatedly use MID/FIND as there are thousands of rows with numerous variations of what can follow ^v_cusip= . 我不能重复使用MID / FIND,因为存在成千上万的行,并且可以遵循^v_cusip=各种变化。

Thanks! 谢谢!

What does the rest of cell details look like? 其余单元格的详细信息是什么样的? Is there only '=' sign in each row? 每行只有'='符号吗? If so, perhaps you could do a text to columns and use the '=' sign as the delimiter. 如果是这样,也许您可​​以对列进行文本处理并使用'='符号作为分隔符。

Once it's split should put the ID in a predictable column. 拆分后,应将ID放在可预测的列中。

=LEFT(RIGHT(A2;LEN(A2)-FIND("^v_cusip=";A2)-8);FIND("^";RIGHT(A2;LEN(A2)-FIND("^v_cusip=";A2)-8))-1)

This will show only the part between ^v_cusip= and the next ^ character. 这将仅显示^ v_cusip =和下一个^字符之间的部分。 You can further split the string by comma. 您可以进一步用逗号分隔字符串。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM