[英]How do I create a formula in excel that compares text in cells and returns a percentage
I have a excel spreadsheet that every cell will have either three values, Pass, Fail or na(not available). 我有一个Excel电子表格,每个单元格都有三个值,通过,失败或na(不可用)。 This is an example of what the spreadsheet will look like
这是电子表格外观的一个示例
So I will like to have a formula that will compare all the cells and returned 100% "completion" when all the cells have "Pass" on them. 因此,我希望有一个公式可以比较所有单元格,并且当所有单元格上都带有“ Pass”时返回100%的“ completion”。
Use COUNTIF(): 使用COUNTIF():
=COUNTIF(A1:A10,"Pass")/COUNTIFS(A1:A10,"<>na")
Then format the output cell as Percentage. 然后将输出单元格格式设置为“百分比”。
This will return the percentage of cells that have "Pass" in them out of all the cells that are not na
in A1:A10 (1) . 这将返回在A1:A10 (1)中不是
na
的所有单元格中具有“通过”的单元格的百分比。
(1) As your picture does not include row and column references, I put a general range in my formula, you will want to change the range reference to those of the range to be tested. (1)由于您的图片不包含行和列引用,因此我在公式中放置了一个常规范围,因此您需要将范围引用更改为要测试的范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.