اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

احتاج القيم المفقود بين رقمين حسب التسلسل


إذهب إلى أفضل إجابة Solved by lionheart,

الردود الموصى بها

السلام عليكم 

مرفق ملف اكسيل يوضح ويوجد قيمة مفقودة احتاج معرفتها حسب التسلسل 

          الراتب من 3000 يحصل على مبلغ 1350 في 240  يحصل على 324000

Book1.xlsx

رابط هذا التعليق
شارك

  • أفضل إجابة

Try this code

Sub Test()
    Const FIXEDPERIOD As Long = 240
    Dim outputArray(), currentAmount As Long, relatedValue As Long, i As Long
    ReDim outputArray(2000, 3)
    currentAmount = 3000
    For i = LBound(outputArray) + 1 To UBound(outputArray) + 1
        If currentAmount <= 4000 Then
            relatedValue = 1350 - (currentAmount - 3000) * (1350 - 1206) / 1000
        Else
            relatedValue = 1206 - (currentAmount - 4000) * (1206 - 1073) / 1000
        End If
        outputArray(i - 1, 0) = currentAmount
        outputArray(i - 1, 1) = FIXEDPERIOD
        outputArray(i - 1, 2) = relatedValue
        outputArray(i - 1, 3) = FIXEDPERIOD * relatedValue
        currentAmount = currentAmount + 1
        If currentAmount Mod 1000 = 0 Then relatedValue = outputArray(i - 1, 2)
    Next i
    Columns("H:K").ClearContents
    Range("H2").Resize(, 4).Value = Array("Salary", "Period", "Amount", "Total")
    Range("H3").Resize(UBound(outputArray, 1) + 1, UBound(outputArray, 2) + 1).Value = outputArray
End Sub

 

  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information