如果条件为条件,交换两列

时间:2019-07-04 09:41:23

标签: excel

我想交换A1> B1的值。我如何获得预期的结果 -----------------------------------------------

    A   |  B
  ______|______
1  10   | 20
  ______|______
2  50   | 40
  ______|______
3  60   | 70
  ______|______
4  80   | 50
  ______|______
5  20   | 22
  ______|______
6  50   | 10
  ______|______
7  80   | 50
  ______|______
8  50   | 10
  ______|______

如果A1> B1条件为true,则结构看起来像这样

    A   |  B
  ______|______
1  10   | 20
  ______|______
2  40   | 50
  ______|______
3  60   | 70
  ______|______
4  50   | 80
  ______|______
5  20   | 22
  ______|______
6  10   | 50
  ______|______
7  50   | 80
  ______|______
8  10   | 50
  ______|______

1 个答案:

答案 0 :(得分:0)

    A   |  B    |  C   |  B   
  ______|______ |______|_____
1  10   | 20    |      |
  ______|______ |______|_____
2  40   | 50    |      |
  ______|______ |______|_____
3  60   | 70    |      |
  ______|______ |______|_____
4  50   | 80    |      |
  ______|______ |______|_____
5  20   | 22    |      |
  ______|______ |______|_____

C1中的公式为

=IF(A1>B1; B1; A1)

B1中的公式将为

=IF(A1>B1; A1; B1)

现在您只需要隐藏其他两列即可:)