简体   繁体   中英

Excel to return a value in a cell after checking a range of cells

In Excel I have a range of cells; for simplicity say three columns A1:A3 containing either the letter P, M or D. I would like to be able to check this range of cells and display in cell A4 either P, M or D depending on the frequency of the letters (see below for example of intended results). Need all cells as D to result in D. Its to track student grades, Pass (lowest denominator), Merit and Distinction.

PPP = P; PMP = P; MPP = P; PPM = P; MMM = M; MDD = M; MMD = M; DMM = M; DDD = D; PMD = P

Use this:

=IF(COUNTIF(A1:A3,"P"),"P",IF(COUNTIF(A1:A3,"M"),"M","D"))

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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