简体   繁体   中英

Excel - List all values for column A where the corresponding value in column B is blank

In Microsoft Excel I want to create a column that lists all of the values from column A, where the corresponding field in column B of the same row is blank (eg. where cell B2 is blank, I want to display the contents of cell A2).

I don't want to display any cells from column A where the corresponding cell in column B of the same row is not blank (eg. where cell B3 is not blank, don't display cell A3, or any value at all)

The data might look like this:

A   B
--- ---
123 
234 345
456 456
567 

What I want to display is a new column with only the values from column A where column B in the same row is blank, like this, so all I would see from the above is:

C
---
123
567

I tried this:

=IF(B2="",A2)

However the above displays a value of "FALSE" wherever column B is blank, like this:

C
--------
123
FALSE
FALSE
567

Is there a way I can do what I'm asking above?

You can try this array formula:

=INDEX($A$1:$A$4;SMALL(IF(TRIM($B$1:$B$4)="";ROW($A$1:$A$4)-ROW($A$1)+1;"");ROW(A1)))

I assume, in this case values in A1:B4 Dont forget it is an array formula so Ctrl Shift Enter to enter the formula.

Write the formula wherever you want and then copy down to get next values

Depending on your Regional Settings you may need to replace field separator ";" by ","

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