在单个参数保持块完整的excel合并单元格上排序 [英] Sort on excel merged cells on single parameter keeping block intact

查看:87
本文介绍了在单个参数保持块完整的excel合并单元格上排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



需要以奇怪的方式对这个excel数据进行排序!!



我有以下方式的数据:



Hello All,

Need a hand in sorting this excel data in a weird way!!

I have data in following manner:

Name  |     Stat     |     Value

Emp1  |     outc     |      2
Emp1  |     inc      |      NA

Emp2  |     outc     |      10
Emp2  |     inc      |      4

Emp3  |     outc     |      6
Emp3  |     inc      |      20







现在我需要按降序排序'out'值的数据,但是同时,emp名称块将保持完整,即其他参数值不会被排序。因此输出将是






Now I need to sort this data on 'out' value in descending order but at the same time, the emp name block is to be intact i.e other parameter values will not be sorted. Output hence will be

Name  |     Stat     |     Value

Emp2  |     outc     |      10
Emp2  |     inc      |      4

Emp3  |     outc     |      6
Emp3  |     inc      |      20

Emp1  |     outc     |      2
Emp1  |     inc      |      NA





请帮助!!我正在使用excel vba。任何建议都会非常有帮助!



我尝试过:



我已经取消了emp单元格,然后对数据进行排序。但是块没有完好无损。



Please help!! I am using excel vba. Any suggestion will be very helpful!

What I have tried:

I have unmerged the emp cells and then sort the data. But the block is not remaining intact.

推荐答案

最简单的方法是创建一个排序助手列:



假设Name是col C,Stat是col D,Value是col E第5行中的公式是:



The easiest would be to create a sort helper column:

assuming Name is col C, Stat is col D and Value is col E the formula in row 5 would be:

=TEXT(IF(C5=C4,E4,E5),"000000")&C5





排序将在列上公式在(降序),第二个关键列是Stat列(Descending)。



所以公式......如果Emp#是相同的上面的行,使用上面的行,否则使用同一行上的值。



The sort would then be on the column this formula is in (Descending) and the second key column would be the Stat column (Descending).

So the formula... if the Emp# is the same as the row above, use the row above value, otherwise use the value on the same row.


这篇关于在单个参数保持块完整的excel合并单元格上排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆