如何将水平数据移至垂直订单项?
我创建了一个Excel表,其中包含不同的库存项目,这些库存项目保存在不同的物理位置。该表是根据各种库存表编译的。
我的桌子看起来像这样:
-------------------------------------------------------------------------
|Item Name|Item Description|Qty loc1|Qty loc2|Qty loc3|Qty loc4|Qty loc5|
-------------------------------------------------------------------------
|Item 1 |Item 1 Descr | 2| 4| 5| 3| 1|
-------------------------------------------------------------------------
|Item 2 |Item 2 Descr | 8| | 5| | 1|
-------------------------------------------------------------------------
|Item 3 |Item 3 Descr | | 4| | 3| 1|
-------------------------------------------------------------------------
|Item 4 |Item 4 Descr | 4| | 5| | 1|
-------------------------------------------------------------------------
|Item 5 |Item 5 Descr | | | | | |
-------------------------------------------------------------------------
|Item 6 |Item 6 Descr | 1 | | | | 3 |
-------------------------------------------------------------------------
我希望我的桌子看起来像这样:
----------------------------------------------
|Item Name|Item Description|Qty |Loc Name|
----------------------------------------------
|Item 1 |Item 1 Descr | 2| Loc1|
----------------------------------------------
|Item 1 |Item 1 Descr | 4| Loc2|
----------------------------------------------
|Item 1 |Item 1 Descr | 5| Loc3|
----------------------------------------------
|Item 1 |Item 1 Descr | 3| Loc4|
----------------------------------------------
|Item 1 |Item 1 Descr | 1| Loc5|
----------------------------------------------
|Item 2 |Item 2 Descr | 8| Loc1|
----------------------------------------------
|Item 2 |Item 2 Descr | 5| Loc3|
----------------------------------------------
|Item 2 |Item 2 Descr | 1| Loc5|
----------------------------------------------
|Item 3 |Item 3 Descr | 4| Loc2|
----------------------------------------------
|Item 3 |Item 3 Descr | 3| Loc4|
----------------------------------------------
|Item 3 |Item 3 Descr | 1| Loc5|
----------------------------------------------
等...
在这种情况下,有些位置没有任何项目因此,单元格为空白。
一个项目应只有在任何位置都有任何库存时才有一条线。
我尝试在同一工作簿中制作单独的工作表以使单独的工作表能够提取单元格值,但这不是工作。解决这个问题的最佳方法是什么?这将是什么公式?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用power查询
自己做
项目描述
将其添加到选择中。项目描述
,在弹出菜单中选择 undivot other列。value
并将其拖到左侧属性
列。value
和在弹出菜单中选择重命名... 并将列重命名为QTY
。属性
,在弹出菜单中选择重命名... 并将列重命名为loc名称
。loc名称
和在弹出菜单中选择替换值... 和在替换值对话框中,在 value中查找文本框中,EnterQTY
(请注意尾随空间)和按 ok 。LOC名称
,在弹出菜单中选择 transform 和在变换弹出菜单中选择大写每个单词。使用M-Code
右键单击您的桌子和弹出窗口菜单选择从表/范围获取数据... 。
电源查询编辑器打开。
在功能区中,选择高级编辑器并将当前代码替换为以下一个(复制代码,单击框中,然后使用ctrl+a和ctrl+v)。
如有必要,请调整表名和列名。
选择完成。
Unpivot Using Power Query
Do It Yourself
Item Description
to add it to the selection.Item Description
and in the pop-up menu select Unpivot Other Columns.Value
and drag it to the left so the column switches places with theAttributes
column.Value
and in the pop-up menu select Rename... and rename the column toQty
.Attributes
and in the pop-up menu select Rename... and rename the column toLoc Name
.Loc Name
and in the pop-up menu select Replace Values... and in the Replace Values dialog, in the Value To Find text box, enterQty
(note the trailing space) and press OK.Loc Name
and in the pop-up menu select Transform and in the Transform pop-up menu select Capitalize Each Word.Use the M-Code
Right-click on your table and in the pop-up menu select Get Data from Table/Range....
The Power Query Editor opens.
In the ribbon, select Advanced Editor and replace the current code with the following one (copy the code, click in the box and use Ctrl+A and Ctrl+V).
Adjust the table name and the column names if necessary.
Select Done.