取括号之间的值 [英] Get the value between the brackets
本文介绍了取括号之间的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个列,其中有些东西看起来像以下字符串: V2397(+60)
I have a column with some stuff that looks like the following string: V2397(+60)
如何获取括号之间的值?在这种情况下, +60
。
How do I get the value between the brackets? In this case the +60
.
括号之前的数字(和字符)不是标准化的,括号之间的数字(可以是100,10 -10甚至0 ...)。
The number (and character) before the brackets is not something standardized and neither the number between the brackets (it can be 100, 10 -10 or even 0...).
推荐答案
VBA代码:
cellValue = "V2397(+60)"
openingParen = instr(cellValue, "(")
closingParen = instr(cellValue, ")")
enclosedValue = mid(cellValue, openingParen+1, closingParen-openingParen-1)
显然 cellValue
应该从单元格中读取。
Obviously cellValue
should be read from the cell.
或者,如果单元格A1具有这些值之一,则可以使用以下公式将附加的值引入到不同的单元格:
Alternatively, if cell A1 has one of these values, then the following formula can be used to extrcat the enclosed value to a different cell:
=Mid(A1, Find("(", A1)+1, Find(")",A1)-Find("(",A1)-1)
这篇关于取括号之间的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文