作者:乔山办公网日期:
返回目录:excel表格制作
1、使用List:
public static boolean useList(String[] arr, String targetValue) {
return Arrays.asList(arr).contains(targetValue);
}
2、使用Set:
public static boolean useSet(String[] arr, String targetValue) {
Set<String>
set = new HashSet<String>(Arrays.asList(arr));
return set.contains(targetValue);
}
3、使用循环判断:
public static boolean useLoop(String[] arr, String targetValue) {
for(String s: arr){
if(s.equals(targetValue))
return true;
}
return false;
}
4、使用Arrays.binarySearch():
public static boolean useArraysBinarySearch(String[] arr, String targetValue) {
inta = Arrays.binarySearch(arr, targetValue);
if(a> 0)
return true;
else
return false;
}
一般老说,用countif、find、mid、substitute都可知以对一个数组中是否存在某道元素作出判断。
上传带行列号的有数据示例的表格截回图,清楚说明已知条件,达成什么样的结果,才答能给你准确的答案。
=SUMPRODUCT(1*({0,2,5,6,8}=A1))
不为0说明属于
数组可以用数据区域来代替:=SUMPRODUCT(1*(B1:B5=A1))