ซึ่งเราจะคำนวณพวก Early Start, Early Finish, Late Start, Late Finish ของแต่ละงานแบบอัตโนมัติครับ บอกไว้ก่อนว่าสูตรในบทความนี้ค่อนข้างซับซ้อน กรุณาทำใจก่อนดู 555
เริ่มลงมือทำ
ข้อมูลดิบใน Excel
เราบันทึกข้อมูลลงไปประมาณนี้
Activity Duration งานก่อนหน้า
A 10
B 12 A,D
C 9 B
D 5
E 7 D,G
F 6 E
G 3
H 4 G
I 6 H
Early Finish (EF)
= ESตัวนั้น + Duration -1
= [@ES]+[@Duration]-1
ซึ่ง EF ก่อนหน้า มันอาจมีหลายตัวก็ได้ เช่น กิจกรรม B มีก่อนหน้าคือ A กับ D ซึ่งเราต้องทำการ Lookup ค่า EF ของ A กับ D ออกมา แล้วหาค่า MAX ซึ่งเราทำแบบนี้ได้
Max EF ก่อนหน้า
=MAX(XLOOKUP(TEXTSPLIT([@งานก่อนหน้า],","),[Activity],[EF]))
ที่นี้จะเห็นว่างานที่จะเสร็จเป็นอันสุดท้ายคือ C ซึ่งจะไปจบวันที่ 31 ไอ้เส้นทางที่จบที่ C นี่แหละ คือ Critical Path ล่ะ
แล้วผมจะส่ง mail invite Live ผ่าน Zoom การอบรม Excel Power Query + Power Pivot ฉบับรวบรัด 2 ชั่วโมง ไปให้ทาง Email ที่ส่ง Slip มาครับ
ณ ตอนนี้มียอดบริจาคเท่านี้แล้วครับ
ยอดบริจาคล่าสุด
เทคนิคการดึงข้อมูล
ผมใช้ n8n ดึงรูป Slip จาก Email แล้วส่งให้ AI อ่านตัวเลขในรูป slip แล้วเอามากรอกใน Google Sheets ให้ จากนั้นเอาไปทำ Dashboard ใน Power BI อีกทีครับ (Refresh เพื่อดึงสดจาก Google Sheets ได้)
Power Pivot สามารถ สร้างความสัมพันธ์ระหว่างตาราง โดยไม่ต้องใช้ VLOOKUP
ซึ่งมีข้อดีหลายอย่าง เช่น
ดึงข้อมูลจากหลายตารางมารวมกันได้อัตโนมัติ
ลดขนาดไฟล์ เพราะไม่ต้อง Copy ข้อมูลซ้ำไปมา
คำนวณเร็วขึ้น เพราะใช้ Data Model แทนการคำนวณแบบ Cell-by-Cell
🔴 3. การคำนวณขั้นสูง (เช่น CALCULATE, Running Total, YTD, MTD) ทำไม่ได้ใน Pivot Table ธรรมดา ถ้าเราใช้ Pivot Table ปกติ จะเจอปัญหา แม้ว่ามันจะมีฟีเจอร์ชื่อว่า Calculated Field มาให้เราสร้าง Field คำนวณขึ้นมาเองได้ แต่ว่าการคำนวณสรุปที่ใช้ได้ถูกจำกัดแค่การ SUM ซึ่งต่างจากเวลาเราใช้ Power Pivot ที่สามารถเขียน Measure ที่สามารถใช้สูตร DAX อะไรก็ได้
นอกจากนี้ใน PivotTable ปกติ แม้จะมี Show Value as มาช่วยคำนวณที่คล้ายกับว่าจะทำ Running Total ได้ แต่จริงๆ แล้วมีข้อจำกัดเยอะ เพราะเครื่องมือไม่ได้เข้าใจความเป็น ปี ไตรมาศ เดือน จริงๆ ซึ่งต่างจาก Time Intelligence ของ DAX ซึ่งสามารถคำนวณเกี่ยวกับเวลาได้อย่างถูกต้องจริงๆ
ตัวอย่างการใช้สูตร DAXใน Measure ของ Power Pivot
Total Sales = SUM(Sales[Amount])
Target Sales = SUM(SalesTarget[TargetAmount])
Sales vs Target % = [Total Sales] / [Target Sales]
' AutoRefresh.vbs - Improved version
On Error Resume Next
Dim objExcel, objWorkbook
Set objExcel = CreateObject("Excel.Application")
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถสร้าง Excel application ได้"
WScript.Quit 1
End If
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Open("C:\Reports\DailyReport.xlsm")
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถเปิดไฟล์ DailyReport.xlsm ได้"
objExcel.Quit
WScript.Quit 1
End If
' เรียก Macro AutoRefreshAndClose
objExcel.Run "AutoRefreshAndClose"
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถเรียกใช้ Macro AutoRefreshAndClose ได้"
objWorkbook.Close False
objExcel.Quit
WScript.Quit 1
End If
' ปิด Workbook (ถ้า Macro ยังไม่ได้ปิด Excel)
objWorkbook.Close True
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
On Error GoTo 0
On Error Resume Next
Dim objExcel, objWorkbook
Set objExcel = CreateObject("Excel.Application")
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถสร้าง Excel application ได้"
WScript.Quit 1
End If
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Open("C:\ReportsReady\DailyReport.xlsm")
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถเปิดไฟล์ DailyReport.xlsm ได้"
objExcel.Quit
WScript.Quit 1
End If
' เรียก Macro SendReport
objExcel.Run "SendReport"
If Err.Number <> 0 Then
WScript.Echo "Error: ไม่สามารถเรียกใช้ Macro SendReport ได้"
objWorkbook.Close False
objExcel.Quit
WScript.Quit 1
End If
' ปิด Workbook และ Excel
objWorkbook.Close True
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
On Error GoTo 0
📌 บันทึกไฟล์เป็น"C:\Scripts\AutoSendEmail.vbs"
โค้ด VBA (SendReport) ใน Excel
📌 VBA มีหน้าที่: ✔ สร้าง Email ใน MS Outlook ✔ แนบไฟล์รายงาน ✔ ส่งอีเมลอัตโนมัติ
Sub SendReport()
On Error GoTo ErrHandler
Dim OutApp As Object
Dim OutMail As Object
Dim AttachmentPath As String
AttachmentPath = "C:\ReportsReady\DailyReport.xlsm"
' ตรวจสอบว่าไฟล์แนบมีอยู่จริงหรือไม่
If Dir(AttachmentPath) = "" Then
MsgBox "ไม่พบไฟล์แนบ: " & AttachmentPath, vbExclamation, "SendReport Error"
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "your_team@example.com"
.CC = "manager@example.com"
.Subject = "Daily Report"
.Body = "แนบไฟล์รายงานประจำวันที่ " & Format(Date, "dd/mm/yyyy") & " ตามที่อัปเดตไว้"
.Attachments.Add AttachmentPath
.Send ' หรือเปลี่ยนเป็น .Display เพื่อเช็คก่อนส่ง
End With
' ล้างตัวแปร
Set OutMail = Nothing
Set OutApp = Nothing
Exit Sub
ErrHandler:
MsgBox "SendReport Error " & Err.Number & ": " & Err.Description, vbCritical, "Error"
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
หลายคนน่าจะใช้ Power Query (ทั้งใน Excel และ Power BI) ดึงข้อมูลจากไฟล์ต่างๆ ทั้งไฟล์ Excel / CSV หรือแม้กระทั่งดึงหลายๆ ไฟล์จาก Folder ในเครื่องตัวเองมารวมกันได้แล้ว… แต่อาจเริ่มอยากพัฒนาไปอีกขึ้น คือ การเอาแหล่ง Data Source ไปไว้บน Online เลย
เพราะถ้าเราดึงจากแหล่งออนไลน์ได้ มันดีกว่าการดึงจากเครื่องตรงที่สามารถทำการ Schedule Refresh ให้ Power BI ได้ รวมถึงแหล่งข้อมูลเอาวางไว้ตรงกลาง ให้เพื่อนๆ มาดึงไฟล์ไปใช้ได้
ว่าแต่การดึงข้อมูลจากแหล่งออนไลน์ด้วย Power Query มันทำยังไงกันแน่? เพราะวิธีมันไม่ได้ตรงไปตรงมานัก
คนที่เคยพยายาลอง Get Data จากบริการ Online ของ Microsoft เองจะพบว่ามันไม่ง่ายเลย บอกเลยว่า จริงๆ แล้วการดึงจากระบบ Microsoft เผลอๆ อาจยากกว่าดึงจากบริการของ Google ซะอย่างงั้น 555
การดึงข้อมูลจาก Google Sheets ที่ง่ายที่สุดคือให้เรา Publish ข้อมูลบน Google Sheets ก่อน โดยไปที่ File- > Share -> Publish to web (ไม่ใช่กด share link ปกตินะ)
การใช้ Publish to web ข้อเสีย คือถ้าใครก็ตามที่มี Link URL ก็จะโหลดไฟล์ไปได้เลย
แล้วกดเลือกว่าจะ Publish เป็นอะไร ซึ่งตัวที่ผมขอแนะนำคือเป็น Microsoft Excel (.xlsx) เพราะเผื่อว่ามีข้อมูลหลายชีท จะได้ไม่มีปัญหา
จากนั้นเราก็จะได้ Link มาซึ่งสามารถเอา URL ที่ได้นี้ไปใช้ใน Power Query โดยเลือก Get Data from Web แล้วแปะ URL แล้ว ok ได้เลย
แล้วผลลัพธ์ก็จะเหมือนกับการ Get Data from Excel ปกติ คือเลือก Sheet เลือก Table ได้เลย
ดึงข้อมูลจาก Google Form
อันนี้แค่เราทำการกดไปที่ Response ของ Google Form แล้วกด Link to Sheets ก็สามารถทำต่อตามหัวข้อตอนที่ดึงจาก Google Sheets ได้เลย
ดึงข้อมูลจาก One Drive Business
สำหรับอันนี้ วิธีทำ คือให้เข้า one drive for business จนเจอไฟล์ที่ต้องการ แล้วต้องกด … แล้วเลือกเปิดไฟล์ใน Desktop App ก่อน เพื่อให้ได้ File Path มา
แล้วกดไปที่ File -> Info -> Copy Path (ไม่ใช่ local นะ)
ซึ่งการใช้ API นั้นจริงๆ ค่อนข้างยืดหยุ่นมาก แต่ก็ใช้ความสามารถทางเทคนิคสูงหน่อย อย่างไรก็ตามในยุคนี้เราใช้ AI มาช่วยได้ด้วย ไว้ผมจะเขียนบทความใหม่ให้อีกทีนะครับ
T.DIST.RT ใช้สำหรับการหาค่าความน่าจะเป็นทางด้านขวาของการแพร่กระจาย t เหมาะในการทดสอบสมมติฐานสำหรับข้อมูลกลุ่มตัวอย่างเล็ก
คำอธิบาย
ส่งคืนการกระจาย t ของ Student ทางด้านขวา (the right-tailed distribution) ฟังก์ชันนี้ใช้ในการทดสอบสมมติฐานของชุดข้อมูลที่มีขนาดเล็ก ใช้แทนที่ตารางค่าที่สำคัญสำหรับการกระจาย t ได้ตามต้องการ
มีครั้งแรกในเวอร์ชันไหน
2010
รูปแบบคำสั่ง (Syntax)
T.DIST.RT(x, deg_freedom)
Arguments
x (Required – numeric)
ค่าตัวเลขที่ต้องการประเมินผลจากการกระจายตาราง t (distribution table)
Description: ประเมินผลการกระจาย t ของนักเรียน แบบ one-tailed ทางซ้ายด้วยค่า x = 1.959999998 และ degree of freedom = 60 Result:0.027322 (ผลลัพธ์เป็นเปอร์เซ็นต์ที่ใช้ในการตัดสินใจทางสถิติ)
Formula:
=T.DIST.RT(2, 10)
Description: ประเมินผลการกระจาย t ของนักเรียนทางขวาด้วยค่า x = 2 และ degree of freedom = 10 Result:0.0361 (ค่าความน่าจะเป็นแบบละเอียดสำหรับการทดสอบ t-test)
Formula:
=T.DIST.RT(1.5, 200)
Description: คำนวณการแพร่กระจาย t แบบข้างเดียวของ x = 1.5 เมื่อ degree of freedom = 200 Result:0.0675 (แสดงความน่าจะเป็นของจุดที่ให้มาภายใต้การกระจาย t)
Formula:
=T.DIST.RT(A1, A2)
Description: หาค่าความน่าจะเป็นที่ตำแหน่ง x ในเซลล์ A1 เมื่อ degree of freedom ในเซลล์ A2 Result:ค่าความน่าจะเป็นขึ้นอยู่กับค่าใน A1 และ A2
Formula:
=IF(T.DIST.RT(B1, B2)>0.05, "Fail to reject", "Reject")
Description: การใช้ T.DIST.RT ในการทำงานร่วมกับฟังก์ชั่น IF เพื่อช่วยในการตัดสินใจจากค่าความน่าจะเป็น Result:"Fail to reject" or "Reject" ขึ้นกับค่าที่ได้จาก T.DIST.RT
Formula:
=T.DIST.RT(3, 8)
Description: หาค่าการกระจาย t ด้านขวา เมื่อค่า x = 3 และ degree of freedom = 8 Result:0.009124 (ค่าตัวเลขที่ต่ำแสดงถึงความน่าจะเป็นที่ต่ำจากการทดสอบ t-test)
Tips & Tricks
การใช้ T.DIST.RT สามารถใช้ควบคู่กับฟังก์ชันอื่นๆ เช่น IF และในตัวอย่างยังเป็นวิธีที่ดีในการคำนวณค่าคาดการณ์หรือในการหาค่าความน่าจะเป็นเมื่อทำการวิเคราะห์ข้อมูลที่มีระดับอิสระต่ำ
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.