최대 4 개의 아이템을 담을 수있는 팔레트가 있습니다. 때로는 동일한 항목이 하나의 팔레트입니다. 이 팔레트의 배송 라벨을 인쇄하려면 팔레트에있는 항목과 해당 항목의 수량을 나열해야합니다. 열의 고유 한 인스턴스를 계산하는 몇 가지 수식과 스크립트를 찾았지만 동일한 행에 보관 된 데이터는 없습니다. 데이터가 내게 오는 방법은 다음과 같습니다.
나는 공식이나 스크립트가 필요한 것을 보여주기 위해 위의 작업을 수동으로 수행했습니다. 나는 이것을 하루 종일 알아 내려고 노력해 왔으므로 어떤 도움을 주셔서 감사합니다. 감사합니다!
Power Query
Excel 2010+에서 제공되는을 사용 하여이 작업을 수행 할 수도 있습니다.
Data => Get & Transform => From Table/Range
Home => Advanced Editor
열리는 창에 M- 코드를 붙여 넣습니다.Applied Steps
창을 조사하여 작동 방식을 이해합니다.M 코드
let
Source = Excel.CurrentWorkbook(){[Name="Table11"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Item #1", type text}, {"Item #2", type text}, {"Item #3", type text}, {"Item #4", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
#"Grouped Rows" = Table.Group(#"Added Index", {"Index"}, {
{"Grouped", each _, type table [#"Item #1"=nullable text, #"Item #2"=nullable text, #"Item #3"=nullable text, #"Item #4"=nullable text, Index=number]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "uniqueItemList", each
let
//Get list of relevant column Names for grouping of each subTable
colNames = Table.ColumnNames(Source),
tbl1 = Table.SelectColumns([Grouped],colNames),
//Transpose the table
transp = Table.Transpose(tbl1),
//Get a count of each unique Item
grp = Table.Group(transp,"Column1",{"count", each List.Count([Column1])}),
//create Lists of the items and their count and "Zip" them together
col1 = Table.Column(grp,"Column1"),
count = Table.Column(grp,"count"),
zip = List.Zip({col1,count}),
//create the Label string
label = List.Accumulate(zip,"", (state, current)=>
if state = ""
then current{0} & ";" & Text.From(current{1})
else
if List.NonNullCount(current) = 2
then state & ";" & current{0} & ";" & Text.From(current{1})
else state)
in
label),
//split the label string into separate columns
#"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "uniqueItemList", Splitter.SplitTextByDelimiter
(";", QuoteStyle.Csv), {"Slot #1", "Slot #1 Qty", "Slot #2", "Slot #2 Qty", "Slot #3", "Slot #3 Qty","Slot #4", "Slot #4 Qty"}),
//Delete unneeded columns
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Index", "Grouped"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Slot #1", type text}, {"Slot #1 Qty", Int64.Type}, {"Slot #2", type text}, {"Slot #2 Qty", Int64.Type}, {"Slot #3", type text}, {"Slot #3 Qty", Int64.Type}, {"Slot #4", type text}, {"Slot #4 Qty", Int64.Type}})
in
#"Changed Type1"
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다