简体   繁体   中英

Excel - If cells in a column contain a certain value, how can I add the values of the adjacent cells?

Consider this spreadsheet:

在此处输入图片说明

For all the cells in column A that contain the value "Y", how would I add the adjacent cells in column B together?

This is what I've tried so far to no avail, assuming COLUMN__A and COLUMN__B are defined names of cells in those columns:

=IF(ISNUMBER(SEARCH("Y",COLUMN__A)),SUM(COLUMN__B),0)

Try this one:

=SUMIF(A1:A100,"*Y*",B1:B100)

or

=SUMPRODUCT(ISNUMBER(SEARCH("Y",A1:A100))*(B1:B100))

both case insensitive.

Case sensitive formula is:

=SUMPRODUCT(ISNUMBER(FIND("Y",A1:A100))*(B1:B100))

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