[英]How to copy a data row from column A to column B, between each data row
Troubles with the update formula Troubles with formula, asking for a missing matrix Steps, I have tried to retrieve data from column B to column D Know is telling that I insert insufficient arguments Good afternoon,更新公式的问题 公式的问题,要求缺少矩阵步骤,我试图从 B 列到 D 列检索数据知道告诉我插入不足 arguments下午好,
I have column B, with descriptions in Portuguese, row by row and column D with the translations in English: I'm trying to insert in column D the corresponding translation in Portuguese under each data row in English.我有B列,用葡萄牙语逐行描述,D列用英语翻译:我试图在D列中插入对应的葡萄牙语翻译在每个英语数据行下。
But I can't find any formula to do that, also I didn't find any question like this in the forum.但是我找不到任何公式可以做到这一点,我也没有在论坛中找到任何这样的问题。 The only nearest question about, is to insert a blank row between data rows with this formula =MOD(ROW(D2),2)=0 or with a filter adding series.唯一最近的问题是使用此公式 =MOD(ROW(D2),2)=0 或使用过滤器添加系列在数据行之间插入空白行。 And retrieving data with vlookup, as in the attached image.并使用 vlookup 检索数据,如附图所示。
Put this formula in the Result Column and adjust $A$1 to your first portuguese term and $B$1 to you first translated term:将此公式放在结果列中,并将 $A$1 调整为您的第一个葡萄牙语术语,将 $B$1 调整为您的第一个翻译术语:
'=OFFSET($A$1;((ROW()-ROW($B$1))/2)-ROW($A$1)+1;0)
You should get a Column, where every Portuguese term is repeated.您应该得到一个列,其中重复了每个葡萄牙语术语。 Now you can overwrite the formulas in the upper cells with the english translations.现在您可以用英文翻译覆盖上方单元格中的公式。
The formula calculates the difference between current (translated row) cell and the first translated row and cuts it in half: that is the row of the portuguese term to associate with this cell.该公式计算当前(翻译行)单元格与第一个翻译行之间的差异,并将其减半:即与该单元格相关联的葡萄牙语术语的行。 Then it uses that row number as offset to the first row of portuguese terms.然后它使用该行号作为第一行葡萄牙语术语的偏移量。
Now, if you want to have the forst row empty, you can of course fill the whole formula in the true
part of an if
formula:现在,如果您想让 forst 行为空,您当然可以将整个公式填充到if
公式的true
部分:
=IF(MOD(ROW()-ROW($B$1),2)=0;"";OFFSET($A$1;((ROW()-ROW($B$1))/2)-ROW($A$1)+1;0))
That is something you will often do in excel and I assume you know that trick.这是你在 excel 中经常会做的事情,我假设你知道这个技巧。 It makes the core formula a little harder to read, but it basically says: if the current row inside this block is divisible by two, then set the row empty, else set the row equal to the formula I presented above .它使核心公式更难阅读,但它基本上说:如果此块中的当前行可被 2 整除,则将该行设置为空,否则将该行设置为等于我上面介绍的公式。
You can use power query to tackle this task.您可以使用电源查询来解决此任务。
I have used the following data for demonstration.我已使用以下数据进行演示。 Please note I am using Excel 365 English version .请注意我使用的是Excel 365 英文版。
| Portuguese | English |
|------------|---------|
| um | one |
| dois | two |
| três | three |
| quatro | four |
| cinco | five |
| seis | six |
| Sete | seven |
| oito | eight |
| nove | nine |
| dez | ten |
Steps are:步骤是:
Portuguese
, then add an Index column with index starting from 1
, then you should have something like below:制作一个Portuguese
的重复列,然后添加一个索引从1
开始的索引列,那么您应该有如下内容:Transform
tab to merge the English
column with the Portuguese - Copy
column with a custom delimiter such as hashtag #
(as long as this delimiter is not part of your original texts), then you should have:使用“ Transform
选项卡下的“合并列”function 将English
列与Portuguese - Copy
列,例如标签#
(只要此分隔符不是原始文本的一部分),那么您应该具有:Transform
tab to split the merged column by the same delimiter #
, and make sure in the Advanced Settings to choose to put the results into Rows as shown below:使用Transform
选项卡下的Split Columns function 以相同的分隔符#
拆分合并的列,并确保在 Advanced Settings 中选择将结果放入Rows ,如下所示:The output will look like the following: output 将如下所示:
You can choose to remove the Portuguese
column if you do not want to show it in the final output, then Close & Load the table to a new worksheet (by default).如果您不想在最终的 output 中显示Portuguese
列,您可以选择删除它,然后关闭并将表加载到新工作表(默认情况下)。
Here are the power query M Codes behind the scene.这是幕后的电源查询M代码。 All functions used are within GUI so should be easy to follow and execute.使用的所有功能都在 GUI 内,因此应该易于遵循和执行。
let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Portuguese", type text}, {"English", type text}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Portuguese", "Portuguese - Copy"),
#"Added Index" = Table.AddIndexColumn(#"Duplicated Column", "Index", 1, 1),
#"Merged Columns" = Table.CombineColumns(#"Added Index",{"English", "Portuguese - Copy"},Combiner.CombineTextByDelimiter("#", QuoteStyle.None),"Merged"),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Merged Columns", {{"Merged", Splitter.SplitTextByDelimiter("#", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Merged"),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Merged", type text}})
in
#"Changed Type1"
Let me know if you have any questions.如果您有任何问题,请告诉我。 Cheers:)干杯:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.