excel 公式 取列的字母标题
假如是第一列, 取值为 A
public static String getExcelColumnLabel(int num){
String temp="";
//make sure how many letters are there
double i=Math.floor(Math.log(25.0*(num)/26.0+1)/Math.log(26))+1;
if(i>1){
double sub=num-26*(Math.pow(26, i-1)-1)/25;
for(double j=i;j>0;j--){
temp= temp+(char)(sub/Math.pow(26, j-1)+65);
sub=sub%Math.pow(26, j-1);
}
}else{
temp= temp+(char)(num+65);
}
return temp;
}
本文介绍了一种将Excel中列的数字编号转换为对应的字母标题的方法,并提供了一个Java方法实现,该方法能够处理从第1列到第702列(ZZ列)之间的任意一列。

1万+

被折叠的 条评论
为什么被折叠?



