문제

I have an excel file generated by SAP. I need change its format from multiple tables separated by a title to one single table. This is the original table:

original

and i need it to look like this:

alternative

Im new to excel, so i dont have a clue how to do it.

I cant do it manually becuase the file has 5000+ rows.

Any guidance?

도움이 되었습니까?

해결책

I usually use the generic formula:

=IF(XX="",YY,XX/ZZ)

Where XX is a cell you can use to identify a header to append to the individual transactions and YY is the cell directly above the cell you have put your formula. XX is when you need that value itself, ZZ is another value. You'll understand when you apply it.

For instance, here, you could use cell D5 to do this. I would insert two columns before column D (the value of cell D5 is now in cell F5), and put this formula in cell C5:

=IF(F5="",C4,B5)

I will then fill the formula down. This carries the Material ID everywhere down to the last row. There are two quick ways to do this in a file of this type:

  • Copy the formula, scroll to the bottom of the sheet, hold Shift and click the last cell in the column, then paste.
  • Select the cell containing the formula, scroll to the bottom of the sheet, hold Shift and do Ctrl + ,D.

In cell D5, I would put the formula:

=IF(F5="",D4,F5)

And fill it down as well to get the material description.


Now for the size per unit, you can create a column to the right of column K (column K now has 'Size per Unit' since we inserted two columns earlier), and put this formula in cell L6:

=IF(K6="",L5,K6)

Fill it down to get it everywhere.

Now, to finish it up, select the whole sheet and copy/paste values (Paste Special > Paste Values) to remove the formulae. Delete rows 1 and 2, put a filter and sort by a field such as the column 'Metric'. Go to the bottom and delete the no longer needed rows.

As a bonus, if you need to make absolutely sure that the order of the transactions is the same as initially, insert a column somewhere, put sequential numbers into it; that is the first cell in the column has 1, the second 2, then 3 etc and fill to the bottom. Be sure that it is in the filter when you delete the unneeded rows, and sort by this column when you are done.

5000+ rows is still good though, I've had to deal with 10+ workbooks each with ~90000 rows once ;)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top