提取Excel中括号之间的数字? [英] Extract number between brackets in Excel?
问题描述
我一直在寻找答案,但是还没有找到可以工作的东西.很可能是我对Excel的更多代码化"方面缺乏知识.
I've been searching up and down for an answer to this, but haven't found anything I can get to work. It may well be my lack of knowledge in the more "codey" aspects of Excel.
无论如何,这是我的情况: 在C2-C17中,我设置了一些文本,如下所示:[2]工作名称. "[2]"表示我们期望分配的工作时间,其余为分配的名称.
Anyway, this is my situation: In C2-C17, I have some text set up like this:[2] Name of job. The "[2]" indicates the hours we expect the assignment to take, the rest is the name of the assignment.
现在我需要计算所有这些加起来的小时数,因此在B2-B17中(数字会改变),我想提取括号之间的数字,在这种情况下为"2",因此我可以简单地计算并加起来.
Now I need to calculate how many hours all this adds up to, so in B2-B17 (the numbers will change) I would like to extract the number between the brackets, in this case "2", so I can simply calculate and add them up.
我将如何去做?到目前为止,我在工作上花了太长时间,试图找到一种对我有用的解决方案.
How would I go about doing this? I've spent far too long at work by now, trying to find a solution that works for me.
任何帮助将不胜感激!
推荐答案
使用以下公式:MID(cell,start_num, length)
和FIND(text,cell)
因此,公式为:
=MID(B3, FIND("[",B3)+1, FIND("]",B3) - FIND("[",B3) - 1)
这意味着: 从单元格B3中提取文本,从同一单元格中字符[[]的位置加1开始,总共的字符计算如下:]"的位置-"["的位置减去1.
Which means: Extract the text from the cell B3, starting from the location of character "[" plus 1 in the same cell, and a total of chars calculates by: location of "]" - location of "[" minus one.
这篇关于提取Excel中括号之间的数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!