جزاكم الله خيرا
شكرا استاذ ياسر
Function N2T(D As Double) As String
M = Int(D / 100)
H = Int(D / 10) - (M * 10)
A = Int(D - (M * 100 + H * 10))
K = D - (M * 100 + H * 10 + A)
N2T = Num((M), 3) & IIf(M > 0 And (A > 0 Or H > 0), " و ", "") & Num((A), 1) & IIf(A > 0 And H > 1, " و ", " ") & Num((H), 2)
N2T = Replace(N2T, "اثنتانِ عشرة", "اثنتا عشرة")
N2T = Replace(N2T, "ثمانمائة", "ثمنمائة")
N2T = Replace(N2T, "ثلاثمائة", "ثلثمائة")
N2T = Replace(N2T, "و عشرة", "و عشر")
N2T = IIf(N2T = " عشرة", "عشر", N2T)
N2T = IIf(N2T = "مائتانِ ", "مائتا", N2T)
N2T = "فقط " & N2T & IIf(H = 0 And A = 2, "درجتانِ", IIf((H = 1 And A = 0) Or ((H = 0 And A > 2)), " درجاتٍ", IIf(H = 0 And A = 0, " درجةٍ", " درجةً"))) & IIf(K > 0, " و نصفٌ", "")
N2T = Replace(N2T, " ", " ")
N2T = Replace(N2T, "إحدى درجةً", "درجةٌ")
N2T = Replace(N2T, "اثنتانِ درجتانِ", "درجتانِ")
End Function
Function Num(N As Integer, T As Integer) As String
M = "مائة"
H = "ونَ"
Select Case N
Case Is = 1
Num = IIf(T = 3, M, IIf(T = 2, "عشرة", "إحدى"))
Case Is = 2
Num = IIf(T = 3, "مائتانِ", IIf(T = 2, "عشرونَ", "اثنتانِ"))
Case Is >= 3
Num = IIf(T = 3, NN(N) & M, IIf(T = 2, NN(N) & H, NN(N)))
End Select
End Function
Function NN(N As Integer) As String
Select Case N
Case Is = 3
NN = "ثلاث"
Case Is = 4
NN = "أربع"
Case Is = 5
NN = "خمس"
Case Is = 6
NN = "ست"
Case Is = 7
NN = "سبع"
Case Is = 8
NN = "ثمان"
Case Is = 9
NN = "تسع"
End Select
End Function
=IFERROR(IF(B2="","",IF(B2=0,"صفر",n2t(B2))),"")
استخدام الدالة المعرفة :
كما هو الحال في الدوال العادية في الإكسيل يمكن استخدام الدالة ببساطة في أي خلية ، بفرض أن الدرجة مكتوبة في الخلية B2 ، وتريد تفقيط الدرجة في الخلية C3 على سبيل المثال ، قم بوضع المعادلة بالشكل التالي :