คำตอบที่ได้รับเลือกจากเจ้าของกระทู้
ความคิดเห็นที่ 1
=IF(MONTH(C1)>8,IF(MONTH(D1)<8,YEAR(D1)-YEAR(C1)-1,YEAR(D1)-YEAR(C1)),IF(MONTH(D1)>9,YEAR(D1)-YEAR(C1)+1,YEAR(D1)-YEAR(C1)))
C1 = startDay
D1 = thinkDay
ประมาณนี้
C1 = startDay
D1 = thinkDay
ประมาณนี้
▼ กำลังโหลดข้อมูล... ▼
แสดงความคิดเห็น
คุณสามารถแสดงความคิดเห็นกับกระทู้นี้ได้ด้วยการเข้าสู่ระบบ
ถามผู้รู้ วิธีการเขียนสูตร excel โดยแปลงจาก VBA ครับ มือใหม่ขอความช่วยเหลือครับ
ตอนนี้ใช้ VBA ด้วย =GetPansa(TODAY(),N8)
แต่อยากเปลี่ยนไปใช้สูตรธรรมดา จะได้ใช้นามสกุลธรรมดา ได้ เปิดบนมือถือได้
โค๊ดคือ
Function GetPansa(thinkDate As Date, startDate As Date)
Dim yearP As Double
yearP = Year(thinkDate) - Year(startDate)
If (Month(startDate) > 8) Then
GetPansa = yearP
If (Month(thinkDate) < 8) Then
GetPansa = yearP - 1
End If
End If
If (Month(startDate) <= 8) Then
GetPansa = yearP
If (Month(thinkDate) > 9) Then
GetPansa = yearP + 1
End If
End If
End Function
เวลาแปลงเป็นสูตร ต้องเขียนยังไงครับ