Excel - 循环遍历行和反向顺序

时间:2023-01-23 21:09:28

I was looking for a code that loop through all rows (I got too many), and change order for every three rows. I have a form of rows like this... see image

我正在寻找循环遍历所有行的代码(我得到了太多),并且每三行更改一次。我有一种像这样的行......看图像

Need to loop through all rows in column B and reverse order for every three rows and get this (for better analysis). Thank you

需要循环遍历B列中的所有行,并且每三行反向排序并获得此值(以便更好地进行分析)。谢谢

see image

看图像

1 个解决方案

#1


0  

If I understand your question correctly, type this formula into a cell in column B and drag down as far as necessary:

如果我正确理解了您的问题,请将此公式键入B列中的单元格并根据需要向下拖动:

= INDEX(A:A,ROW()+2*(1-MOD(ROW()-1,3)))

VBA is not needed. This formula copies the values from column A to column B, but reverses the order of the entries every three rows as shown in your example image from your question.

不需要VBA。此公式将值从A列复制到B列,但每三行反转条目的顺序,如问题中的示例图像所示。

See below.

见下文。

Excel  - 循环遍历行和反向顺序

#1


0  

If I understand your question correctly, type this formula into a cell in column B and drag down as far as necessary:

如果我正确理解了您的问题,请将此公式键入B列中的单元格并根据需要向下拖动:

= INDEX(A:A,ROW()+2*(1-MOD(ROW()-1,3)))

VBA is not needed. This formula copies the values from column A to column B, but reverses the order of the entries every three rows as shown in your example image from your question.

不需要VBA。此公式将值从A列复制到B列,但每三行反转条目的顺序,如问题中的示例图像所示。

See below.

见下文。

Excel  - 循环遍历行和反向顺序