简体   繁体   中英

Excel: combine multiple rows into single row based on first column which could have empty cell

I need the formula to combine the column B into a single row.

for eg A17.9 Tuberculosis of nervous system, unspecified.

样本

what makes it tricky it could be N number of line for the description

在此处输入图片说明

need help in figuring out the formula. thanks.

Assuming the data is in A1:B11 , in C1 :

=TEXTJOIN(" ",1,IF(LOOKUP(ROW(A$1:A$11),ROW(A$1:A$11)/(A$1:A$11<>""),A$1:A$11)=A1,B$1:B$11,""))

and copied down.

It goes without saying that the last row referenced within the ranges passed (11 here) should be kept to a minimum.

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