:D snasui.com ยินดีต้อนรับ :D
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย :thup: สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ :arrow: ระบุ Version ของ Excel
:!: โปรดทราบ :!:
  1. กรุณาอ่านกฎการใช้บอร์ด (Forum rules) ในตำแหน่งด้านบนของแต่ละบอร์ด
  2. การสมัครสมาชิก การ Login การกู้คืนรหัสผ่าน
    1. สมัครสมาชิกดูขั้นตอนได้ที่ :arrow: สมัครสมาชิก
    2. Login เข้าระบบโดยคลิกปุ่ม Login ตรงมุมขวาบนของหน้านี้ :roll:
    3. การ Login ผ่าน Facebook ดูวิธีที่ :arrow: Login ผ่าน Facebook
    4. ลืมรหัสผ่านสามารถรับรหัสใหม่ได้ที่ :arrow: Reset รหัสผ่าน
  3. มีปัญหาการใช้งาน แจ้งผู้ดูแลระบบได้ที่ :arrow: ติดต่อผู้ดูแลระบบ
  4. กำหนดการตั้งค่าส่วนตัว เช่นตั้งค่าภาษาเป็นไทยหรืออังกฤษดูได้ที่ :arrow: ตั้งค่าส่วนตัว
  5. การตั้งและตอบกระทู้ดูได้ที่ :arrow: วิธีการตั้งและตอบกระทู้
  6. การจัดรูปแบบตัวอักษรด้วย bbcode ในช่องแสดงความคิดเห็นดูได้ที่ :arrow: จัดรูปแบบตัวอักษร
  7. กำหนดขนาดตัวอักษรใน Browser ดูได้ที่ :arrow: กำหนดขนาดตัวอักษรใน Browser

find annual leave

ฟอรัมถาม-ตอบปัญหาการใช้งาน MS Excel and VBA
Forum rules
  1. ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
  2. ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
  3. กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
  4. กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
  5. กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)
  6. กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่
sna
Silver
Silver
Posts: 699
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

find annual leave

#1

Post by sna »

Hi Dear!
How are you doing? Hope you're doing well and Stay safe.
I want to see the place of earn annual leave release a total of the date that they join work.
Below is the condition:
if staff join under or equal 1-January-2021 will get 1.5 days for annual leave automatically until December will get 18 days for annual leave (equal 1.5 days per month)
if staff join date from March-02-2021 until March-10-2021 will get only 1 day for annual leave (on March month)
if staff join date from March-11-2021 until March-20-2021 will get only 0.5 days for annual leave (on March month)
if staff join date from March-21-2021 until March-31-2021 will get only 0 days for annual leave (on March month)

Note: annual leave: 18 days per year, equal 1.5 days per months

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31043
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 365
Contact:

Re: find annual leave

#2

Post by snasui »

:D Please fill the correct result in target cell for easy to understand.
Supachok
Gold
Gold
Posts: 1014
Joined: Wed Jun 18, 2014 11:11 am
Excel Ver: 2013

Re: find annual leave

#3

Post by Supachok »

what is your value result if range is in
2 Jan - 1 Mar (2021)
User avatar
norkaz
Gold
Gold
Posts: 1781
Joined: Wed Jan 12, 2011 7:59 pm
Excel Ver: 2013,365

Re: find annual leave

#4

Post by norkaz »

Hi guy

Refer to above some more requirements from both super Excel experts to understand better.

1.Would you please place the possible results for the length of join and the earn annual leave?

2.The earn annual leave is just only for March month,
OR included the other ways by automatically calcuation when the time changes such as April , May ,Jun, … December / 2021?

If yes, please place the possible results for us to understand better.

Norkaz
Supachok
Gold
Gold
Posts: 1014
Joined: Wed Jun 18, 2014 11:11 am
Excel Ver: 2013

Re: find annual leave

#5

Post by Supachok »

You didn't hit to hte point of both requested.
this is hard to solve your question
sna
Silver
Silver
Posts: 699
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: find annual leave

#6

Post by sna »

Hi
Here is an attached file

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
norkaz
Gold
Gold
Posts: 1781
Joined: Wed Jan 12, 2011 7:59 pm
Excel Ver: 2013,365

Re: find annual leave

#7

Post by norkaz »

Hi Guy

I'm trying to clarify something that you need but it's still complicated to make it more clear for me about your points.

I mean if my understand is correct your points is not just only for March month -- when the time changes to April, May,... until the end of the year, the results could be automatically updated.

But if you need for all year automatically results , my point is what's the criteria in each month would be -- It's still the same such as 1-10,11-20,21-30 or anything else?

However, I suggest to solve this problems by create the annual leave table like the yellow highlight as attached or you could adapt it to another way like this.

F3
=SUMIFS(INDEX($I$3:$T$8,MATCH(D3,$H$3:$H$8,1),0),$I$2:$T$2,">="&IF(D3<=44197,1,MONTH(D3)),$I$2:$T$2,"<="&MONTH(TODAY()))

Hope this helps.

Norkaz
You do not have the required permissions to view the files attached to this post.
sna
Silver
Silver
Posts: 699
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: find annual leave

#8

Post by sna »

Yes.that's the point but I don't need a helper
is there any way to solve?
User avatar
norkaz
Gold
Gold
Posts: 1781
Joined: Wed Jan 12, 2011 7:59 pm
Excel Ver: 2013,365

Re: find annual leave

#9

Post by norkaz »

Hi Guy

I don't think without helper table would be better to solve this case.

As the time changes is really important to impact anyting else via the Excel calculation -- then without the helper table ,we need the really complicated formula just only in one cell to calculate the right result and it's quite difficult to find out if anything wrong would happen.

It probably will :)

For my suggestion the annual leave table would be better to solve the problems like this.

Anyway, without the helper table - please try this.

F3
=IF(D3<=44197,E3*1.5,IF(D3=44256,1.5,IF(AND(D3>=44257,D3<=44265),1,IF(AND(D3>=44266,D3<=44275),0.5,IF(AND(D3>=44276,D3<=44286),0,E1*1.5)))))+IF(D3<=44197,0,IF(TODAY()>44286,MONTH(TODAY())-3,0)*1.5)

Norkaz
You do not have the required permissions to view the files attached to this post.
User avatar
Bo_ry
Gold
Gold
Posts: 1245
Joined: Sun Aug 12, 2018 12:11 am
Excel Ver: MS 365
Contact:

Re: find annual leave

#10

Post by Bo_ry »

Post #6 March-11-2021 I want this earn annual leave show/get only 1 day for claim

F3
=IFERROR(1.5/(1/DATEDIF(MAX(DATE(YEAR(TODAY()),1,1),D3),EOMONTH(TODAY(),0)+1,"m")),--(DAY(D3)>10))


But Post#1 if staff join date from March-11-2021 until March-20-2021 will get only 0.5 days for annual leave (on March month)
G3
=IFERROR(1.5/(1/DATEDIF(MAX(DATE(YEAR(TODAY()),1,1),D3),EOMONTH(TODAY(),0)+1,"m")),0.5*(3-CEILING(DAY(D3),10)/10))
You do not have the required permissions to view the files attached to this post.
sna
Silver
Silver
Posts: 699
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: find annual leave

#11

Post by sna »

Bo_ry could you explain your formula?
Thanks
User avatar
Bo_ry
Gold
Gold
Posts: 1245
Joined: Sun Aug 12, 2018 12:11 am
Excel Ver: MS 365
Contact:

Re: find annual leave

#12

Post by Bo_ry »

Go to Ribbon Formula > Evaluate formula
Post Reply