简体   繁体   中英

Excel - Copy to Left if Empty Cell

EXCEL SAMPLE SHEET
     A   B   C   D
1 | 53 |   |   |
2 |    | 5 |   |
3 | 12 |   |   |
4 |    |   | 6 |
5 |    |   |   |  1
6 |    | 4 |   |
7 |            | 55  

I want to be able to have one column in the end with all the values from COL AD (except in reality its a lot more columns/rows)

Basically, each row has one value spread across the columns accordingly. I want to copy into the blank space in the first row with all the rest of the values. Since there is only one value per row, it will always be blank in any other column.

Final product should be one column list of [53,5,12,6, 1,4,55]

What I've been doing so far is selecting the blank cells and setting it equal to the next col. But if I do so I have to do it manually for about +50 columns. I was wondering if there was a more efficient method to solve this problem.

Thanks

// EDIT

Purpose of Task

 COL A | COL B | COL C 1 (Dan, Annotation ID 5) | [143, 4] | 2 (Red shirt man, Annotation ID 143) | [4, 5] | 3 (Woman, Annotation ID 2) | | [30] 4 (Man, Annotation ID 4) | [5, 143] | 5 (Girl, Annotation ID 30) | | [2] 

COL A has a list of all annotations of entities COL B has first entity (ie Dan) with the list of co-references listed for each entity. COL C the second entity, and so on. Goal is to have a final column of B to etc. combined. (IF this explanation is helpful)

如果数据为数字,则可以输入E1并填写以下公式:

=LOOKUP(1E100,A1:D1)

If there's only 1 value in each row then you could just sum the row, eg

=SUM(A1:D1)

copy down

Edit: I assumed your data was numeric because that's what you showed in your sample - if not try this variation on lori_m's suggestion

=LOOKUP(2,1/(A1:D1<>""),A1:D1)

Assumes data in the range A1:D1, edit as required

This works independent of it being numbers:

E1: =A1&B1&C1&D1

This combines all entries and since all but one coloumn is empty you will have the one value you wanted.

I'm not 100% sure I understand the question.

You want to copy the values of every cell in the table cell, separating the values with commas? And each row will only have 1 cell with a value in it?

I can't think of any way to do this without a lengthy if statement. Could you give a little extra detail on what the purpose of the table is?

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