|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
你可以看看算法可对:
Public Sub DM()
Dim i As Long, RNo As Long, Data As Double
Dim DB As Double
RNo = Sheet2.Cells.Rows.Count
RNo = Sheet2.Range("A" & RNo).End(xlUp).Row
Data = Val(Sheet2.Cells(1, 3))
For i = 2 To RNo
DB = Val(Sheet2.Cells(i, 3))
Select Case DB
Case Is < 0.8 * Data
Sheet2.Cells(i, 5) = 1500 + Data * 0.008
Case Is <= Data
Sheet2.Cells(i, 5) = 1700 + Data * 0.008 + (DB - Data * 0.8) * 0.02
Case Is > Data
Sheet2.Cells(i, 5) = 1900 + Data * 0.008 + Data * 0.016 + (DB - Data) * 0.03
End Select
Next
End Sub
|
|