发布网友 发布时间:2022-04-21 21:42
共2个回答
热心网友 时间:2023-01-12 06:44
假设直径在a列,重量在b列
b2输入公式
=if(or(a2<=12,a2>=28),round(a2^2*0.6165,3),round(a2^2*0.6165,2))
不过12^2*0.6165好像等于
88.776啊,如果想得到你的值
上面公式就改为
=if(or(a2<=12,a2>=28),round(a2^2*0.6165,3),round(a2^2*0.6165,2))/100
热心网友 时间:2023-01-12 08:02
比较复杂,要使用自定义函数,
下面代码复制到模块中,
单元格中输入公式=FLW(Range)
Function
FLW(X
As
Range)
Dim
a
As
String
Dim
d
As
Boolean
Dim
i
As
Long
Dim
j
As
Long
For
i
=
1
To
Len(X)
a
=
Mid(X,
i,
1)
If
a
=
"."
Then
d
=
True
FLW
=
FLW
&
a
ElseIf
Val(a)
>
0
Or
a
=
"0"
Then
If
d
Then
j
=
j
+
1
If
j
=
1
Then
FLW
=
FLW
&
a
End
If
Else
FLW
=
FLW
&
a
End
If
ElseIf
Val(a)
=
0
Then
j
=
0
d
=
False
FLW
=
FLW
&
a
End
If
Next
i
End
Function