早教吧作业答案频道 -->其他-->
电子表格求函数:在某单元格显示0到99这100个数字中符合给定条件的所有数字.条件:1、A2为“某数”的十位数与个位数的和的尾数,2、B2为“某数”除9余数,3、A2和B2是经过考虑后填入的,4、
题目详情
电子表格求函数:在某单元格显示0到99这100个数字中符合给定条件的所有数字.
条件:1、A2为“某数”的十位数与个位数的和的尾数,
2、B2为“某数”除9余数,
3、A2和B2是经过考虑后填入的,
4、“某数”是大于等于0小于等于100的整数,
要求:在C2输入函数后显示0—99中没有十位数与个位数的和的尾数为A2的所有数和除9余数为B2的所有数.
例如:1、A2等于7,B2等于8,那么C2显示:0,1,2,3,4,5,6,9,10,11,12,13,14,15,18,19,20,21,22,23,24,27,28,29,30,31,32,33,36,37,38,39,40,41,42,45,46,47,48,49,50,51,54,55,56,57,58,59,60,63,64,65,66,67,68,69,72,73,74,75,76,77,78,79,81,82,83,84,85,86,87,88,90,91,92,93,94,95,96,97,99(在C2里面没有:7,16,25,34,43,52,61,70,89,98,因为它们的A2=7,也没有:8,17,26,35,44,53,62,71,80,89,98,因为它们的B2=8)
2、A3等于6,B3等于1,那么C3显示:0,2,3,4,5,7,8,9,11,12,13,14,16,17,18,20,21,22,23,25,26,27,29,30,31,32,34,35,36,38,39,40,41,43,44,45,47,48,49,50,52,53,54,56,57,58,59,61,62,63,65,66,67,68,69,70,71,72,74,75,76,77,78,80,81,83,84,85,86,87,89,90,92,93,94,95,96,98,99(在C3里面没有:6,15,24,33,42,51,60,79,88,97,因为它们的A3=6,也没有:1,10,19,28,37,46,55,64,73,82,91,因为它们的B3=1)
条件:1、A2为“某数”的十位数与个位数的和的尾数,
2、B2为“某数”除9余数,
3、A2和B2是经过考虑后填入的,
4、“某数”是大于等于0小于等于100的整数,
要求:在C2输入函数后显示0—99中没有十位数与个位数的和的尾数为A2的所有数和除9余数为B2的所有数.
例如:1、A2等于7,B2等于8,那么C2显示:0,1,2,3,4,5,6,9,10,11,12,13,14,15,18,19,20,21,22,23,24,27,28,29,30,31,32,33,36,37,38,39,40,41,42,45,46,47,48,49,50,51,54,55,56,57,58,59,60,63,64,65,66,67,68,69,72,73,74,75,76,77,78,79,81,82,83,84,85,86,87,88,90,91,92,93,94,95,96,97,99(在C2里面没有:7,16,25,34,43,52,61,70,89,98,因为它们的A2=7,也没有:8,17,26,35,44,53,62,71,80,89,98,因为它们的B2=8)
2、A3等于6,B3等于1,那么C3显示:0,2,3,4,5,7,8,9,11,12,13,14,16,17,18,20,21,22,23,25,26,27,29,30,31,32,34,35,36,38,39,40,41,43,44,45,47,48,49,50,52,53,54,56,57,58,59,61,62,63,65,66,67,68,69,70,71,72,74,75,76,77,78,80,81,83,84,85,86,87,89,90,92,93,94,95,96,98,99(在C3里面没有:6,15,24,33,42,51,60,79,88,97,因为它们的A3=6,也没有:1,10,19,28,37,46,55,64,73,82,91,因为它们的B3=1)
▼优质解答
答案和解析
在一个单元格中显示这么多数,你得写多长的公式呀?
用VBA处理吧
代码如下,输入了A2和B2的数字后运行此宏即可得到你要的结果
Sub aa()
Dim x%,arr()
For x = 0 To 99
If x < 10 Then
If x Range("A2") And x Mod 9 Range("B2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
Else
If x Mod 9 Range("B2") And Left(x,1) + Right(x,1) Range("A2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
End If
Next x
Range("C2") = Join(arr,",")
End Sub
也可以用如下代码,单元格事件完成的,输入即得到结果
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" Or Target.Address = "$A$2" Then
Dim x%,arr()
For x = 0 To 99
If x < 10 Then
If x Range("A2") And x Mod 9 Range("B2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
Else
If x Mod 9 Range("B2") And Left(x,1) + Right(x,1) Range("A2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
End If
Next x
Range("C2") = Join(arr,",")
End If
End Sub
用VBA处理吧
代码如下,输入了A2和B2的数字后运行此宏即可得到你要的结果
Sub aa()
Dim x%,arr()
For x = 0 To 99
If x < 10 Then
If x Range("A2") And x Mod 9 Range("B2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
Else
If x Mod 9 Range("B2") And Left(x,1) + Right(x,1) Range("A2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
End If
Next x
Range("C2") = Join(arr,",")
End Sub
也可以用如下代码,单元格事件完成的,输入即得到结果
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" Or Target.Address = "$A$2" Then
Dim x%,arr()
For x = 0 To 99
If x < 10 Then
If x Range("A2") And x Mod 9 Range("B2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
Else
If x Mod 9 Range("B2") And Left(x,1) + Right(x,1) Range("A2") Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = x
End If
End If
Next x
Range("C2") = Join(arr,",")
End If
End Sub
看了电子表格求函数:在某单元格显示...的网友还看了以下:
A=1998*1998*1998*……*1998(50个1998连乘积),A的各位数字和是B,B的 2020-05-13 …
( )the phone is ringing括号里填什么啊?括号里第一个字母是b 2020-05-16 …
Betweentwociasses,wehavea().填开头字母是b的单词 2020-06-02 …
在三角形ABC中,角ABC所对的边分别为abc,且满足cosA=5分之3,根号十是b,c的等比中项 2020-06-03 …
单词填空:1..IIcoulddothat.(横线上的单词开头字母是"w",末尾字母是"h",一共 2020-06-03 …
3的10000次方的各位数字和是A,A的各位数字和是B,B的各位数字和是C,C是多少? 2020-07-22 …
一个字,9画,上下结构,开头字母是B,是什么字,谁想的多采纳谁的 2020-07-23 …
哪位数学好?来看一看:4444的4444次方的数字和是a,a的数字和是b,b的数字和是c,问c的数 2020-07-24 …
把英语中彩虹各个颜色的首字母连成一句话,要有意义的还要按顺序写,red首字母是r,orange首字母 2020-10-29 …
单词填空:1..IIcoulddothat.(横线上的单词开头字母是"w",末尾字母是"h",一共有 2020-11-01 …