简体   繁体   English

Excel SUMIF函数用于还包含一些文本值的单元格

[英]Excel SUMIF function for cells that also contain some text values

I would like to compute the sum of values inside the A cell, but the unfoturnate thing is that these cells also contain text in the format 我想计算A单元格内的值之和,但毫不奇怪的是,这些单元格还包含以下格式的文本:

  logvitprob=-49.5

Inside the document there can also be empty lines, like this: 在文档内部也可以有空行,如下所示:

 logvitprob=-58.2467                        
 (TOP (DT The)(DT-R (NN company)(NN-R (VBD said)(VBD-R (IN that)(IN-R (DT the)(DT-R (NN number)(NN-R (IN of)(IN-R (NN access)(NN-R (NNS lines)(NNS-R (VBD dropped)(VBD-R (RB slightly)(RB-R (IN in)(IN-R (DT the)(DT-R (NN quarter)(NN-R (DT a)(DT-R (NN decline)(NN-R (VBD attributed)(VBD-R (TO to)(TO-R (JJ seasonal)(JJ-R (NNS fluctuations)))))))))))))))))))))                        

 logvitprob=-39.201                     
(TOP (IN For)(IN-R (DT the)(DT-R (NN year)(NN-R (RB however)(RB-R (NN access)(NN-R (NNS lines)(NNS-R (IN in)(IN-R (NN service)(NN-R (VBP have)(VBP-R (VBN increased)(VBN-R (CD 5.5)(CD-R (NN %)))))))))))))                     

 logvitprob=-83.0381                        
 (TOP (NNP Chairman)(NNP-R (NNP D.H.)(NNP-R (NNP Hibbard)(NNP-R (VBD said)(VBD-R (DT the)(DT-R (NN company)(NN-R (VBZ has)(VBZ-R (VBN set)(VBN-R (DT a)(DT-R (JJ new)(JJ-R (CD five)(CD-R (NN year)(NN-R (NN goal)(NN-R (IN of)(IN-R (VBG doubling)(VBG-R (NNS revenues)(NNS-R (TO to)(TO-R (RB about)(RB-R (\$ \$)(\$-R (CD 1.8)(CD-R (CD billion)(CD-R (IN while)(IN-R (RB steadily)(RB-R (VBG increasing)(VBG-R (NN net))))))))))))))))))))))))))

 I could count the no of lines containing lovvit=smth with =COUNTIF(A1:A103976, "*logvitprob=*"), but how can I compute their sum? Many thanks!                     

Add a column to the right of your logvitprob... values. 在您的logvitprob...值的右侧添加一列。 Write this formula: 写这个公式:

=IFERROR(VALUE(RIGHT(A1,LEN(A1)-FIND("=",A1))),"")

Now that you have extracted your values (provided you have = symbol only in cells that matter) you can sum them up. 现在,您已经提取了值(假设仅在重要的单元格中有=符号),您可以将其汇总。

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

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