Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Excel aç, ALT+F11 kod arayüzüne gir, Insert>Module de Module altına bu kodu yapıştır. Sonra formülü dışarıdan =RiskSuat(A1) gibi bir şekilde çağır. Senin formülün!
Private Function RiskSuat(tev As Variant) As Integer
'blog.suatatan.com
'Pir Yunus Efendi icin ozel yazilmis kod
'Suat ATAN hayrati
Dim risk As Integer
'Risk level 1 icin aralik
Const MINL1 = #11/1/2017#
Const MAXL1 = #12/31/2017#
'Risk level 2 icin aralik
Const MINL2 = #1/1/2018#
Const MAXL2 = #2/28/2018#
'Risk level 3 icin aralik
Const MINL3 = #3/1/2018#
Const MAXL3 = #6/30/2018#
'Risk level 4 icin aralik
Const MINL4 = #7/1/2018#
Const MAXL4 = #10/31/2018#
'Risk level 5 icin aralik
Const MINL5 = #11/8/2018#
Const MAXL5 = #1/1/2020#
'Risk degerimizi varsayian olarak 0 atayalim
risk = 0
If tev > MINL1 And tev < MAXL1 Then
risk = 1
ElseIf tev > MINL2 And tev < MAXL2 Then
risk = 2
ElseIf tev > MINL3 And tev < MAXL3 Then
risk = 3
ElseIf tev > MINL4 And tev < MAXL4 Then
risk = 4
ElseIf tev > MINL5 And tev < MAXL5 Then
risk = 5
Else
risk = 0
End If
'Simdi hesaplanan risk degerimizi B sutunumuza siraliyoruz
RiskSuat = risk
'For dongumuzu guzel guzel next ile devam ettiryoruz
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.