Page 1 of 1
ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 05, 2012 3:15 am
by yukioh
สะหวัดดีครับ อาจาน ก่อนอืนผมต้องออกตัวก่อนว้า พาสาไทย ไม้ค้อยเก่งเท้าไหล
ผมขอลบกวนอาจานช้วยผมหน่อย เกี่วยกับกานคำนวนกานใช้พาหะนะ จะมีกานปับปุงยังไงดีให้มันดีขิ้น
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 05, 2012 7:34 am
by ChoBkuN
ขอลองตอบครับว่า
ถ้าจะให้สร้างสูตรเดียว แล้วลากคลุมทั้งหมด เพื่อดึงข้อมูลในช่อง Grand total ของแต่ละ Sheet มาใส่นั้น
1. คอลัมน์อ้างอิงของ Sheet Summary No(km) ชื่อ ชีท ต้องลบ Space ออกครับ IT 760 เป็น IT760
2. IT760 ควรจะลบคอลัมน์ A เพื่อจะได้เหมือน ชีทอื่นๆ
3. ที่ I4 พิมพ์ =IF(ISBLANK($A4),"",IF(ISERROR(VLOOKUP($A4,INDIRECT("'"&I$3&"'!"&"$A:$I"),9,FALSE)),"",VLOOKUP($A4,INDIRECT("'"&I$3&"'!"&"$A:$I"),9,FALSE)))
(สูตรนี้ยังไม่ถูกต้องครับ)
แต่อันนี้ มันจะมองค่าแรก ไม่ได้รวมค่าทั้งหมดมา
ถ้าจะใช้ Sumproduct ก็จะติดช่อง Grandtotal ทำให้สูตรรวมคำนวนไปด้วย
แต่ถ้าจะให้เอาแต่ช่อง Grand total ของแต่ละ Sheet ก็
ผมขอลองคิดดูก่อนครับ
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 05, 2012 8:08 am
by snasui

Hi, yukioh
Glad to see you and don't worries. You can type in English. Please tell me about your problems and correct results what you want.
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Mon Feb 06, 2012 7:03 am
by yukioh
Hi, all
Thank you for your response ChoBkuN that's very helpfull, I'm glad to c the answer for resolve this
but, i just need to improve that, how can i the fastest way to calculation this millage like:
Example : when i type data in sheet IT760 (166336 to 166366= 30 km this cost for user xxx xxx xxxxxx)
everything link automatically and all IT Grant total every sheet must be summaries @ sheet SUMMARY NO(Kilometer).
เวลาทีเราคียจช้มูนใส ให้ทุกอย่างมัน link ไปเอง หลือ จะมี Macro ที่ทำหน้าที่ทุกอย่างเลีย
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Mon Feb 06, 2012 9:00 am
by ChoBkuN
I want to try answering before Sen' Se'.
In my oppinion.
1. You have to design every sheet as the same table. That it will easy to write formular to summary product from all sheet.
2. And have to delete "Grand total" Column to prevent from summary same product double time. Or move it to another column that's not the same of your data.
3. In this case, I advice you to use "Sumproduct" function to solve this problem krub.
4. Another thing is Rewrite your Refference column to be form as the name sheet. (IT 116 to IT116 "Delete Space")
If you see the attach file below. I have changed somthing in table for easy to write the formular.
For more easier to use. You can redesign it as you want. But don't write any thing as the same of your sheet data. That'll be inturruped the formular.
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Mon Feb 06, 2012 9:23 am
by bank9597
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Mon Feb 06, 2012 12:38 pm
by ChoBkuN
Google translate ช่วยได้ครับ
ตอนแรกว่าจะพิมพ์แล้วให้ google แปลเป็น ญี่ปุ่นแล้วครับ 55
こんにちは はじめまして 遊戯王 >> google translate.
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Mon Feb 06, 2012 1:14 pm
by bank9597
ChoBkuN wrote:Google translate ช่วยได้ครับ
ตอนแรกว่าจะพิมพ์แล้วให้ google แปลเป็น ญี่ปุ่นแล้วครับ 55
こんにちは はじめまして 遊戯王 >> google translate.

ผมกลัวว่าจะผิดครับ พอมันแปลผิด ผมก็ไม่รู้ อายชาวบ้านครับ

Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Wed Feb 08, 2012 5:49 pm
by yukioh
Hi All Helper And Teacher
You can write in ไทย ครับ
again please help me......
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Wed Feb 08, 2012 6:33 pm
by snasui

Try this,
- Delete column "A" on sheet IT116 for shift your data to the same column of other sheets.
- Sheet "SUMMARY NO(Kilometre)." cell I4 enter this formula.
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,IF($A4<>"",LOOKUP(2,1/($A4=INDIRECT("'"&SUBSTITUTE(I$3," ","")&"'!A4:A110")),INDIRECT("'"&SUBSTITUTE(I$3," ","")&"'!I4:I110")))))
Enter > Copy across then down.
If you clear space in all fields in "I3:Q3" on sheet "SUMMARY NO(Kilometre)." the formula above can replace with this formula.
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,IF($A4<>"",LOOKUP(2,1/($A4=INDIRECT("'"&J$3&"'!A4:A110")),INDIRECT("'"&J$3&"'!I4:I110")))))
See attached file as below.
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Wed Feb 15, 2012 11:20 am
by yukioh
ขอบคุนครับ อาจาน มัน work
ผมขอลบกวน อาจานอีกทีเกียวกัีบ ปุม Remove Duplicate กับ ปุม Get Data ครับ
ผมกดแล้ว มัน Error ม้ายรู้ทำงัยดี
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Wed Feb 15, 2012 11:25 am
by yukioh
attached file
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Wed Feb 15, 2012 7:05 pm
by snasui

ค่อย ๆ ถามตอบกันไปนะครับ ช่วยอธิบายว่าต้องการจะทำอะไรมาด้วยครับ จะได้ช่วยหาวิธีได้ เนื่องจากเท่าที่ดู Code Get_Data แล้วไม่เข้าใจเป้าหมายที่ต้องการครับ
และสำหรับ Code การ Remove Duplicate นั้นใช้สำหรับ Excel 2007 ขึ้นไป แต่จากไฟล์แนบเป็น Version 2003 คือมีนามสกุลเป็น .xls อยากทราบว่าปัจจุบันใช้ Excel Version ใดในการทำงานครับ

Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Thu Feb 16, 2012 11:00 am
by yukioh

ครับอาจาน
ผมใช้ excel 2003 ครับ
คือว่า หลังจากที่ผม กรอกข้อมูนเกี่วยกับกานใช้ รถยนต์ แล้ว ผมจะทำ summary โดย กานนำเอา Grant Total ในแต่ละ ITxxx มารวมกันใน SUMMARY NO(Kilometre). ผ่านมาผมจะทำแบบ copy ใีนแต่ละ Sheet ITxxx มารวมกัน แล้วใช้ Excel 2007 remove Duplicate แต่ผนที่ไำด้มันไม้ work ถ้าหากข้อมูนมันเปียนไป
รบกวนอาจานด้วยครีบ....
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Thu Feb 16, 2012 9:38 pm
by snasui

ผมเขียน Code สำหรับ Get Data เฉพาะ Grand Total มารวมให้แล้วตาม Code ด้านล่าง
Code: Select all
Sub Get_Data()
Dim rSource As Variant
Dim rTarget As Range
Dim i As Integer
Sheets("SUMMARY NO(Kilometre).").Range("A70:I" & Rows.Count).Clear
Sheets("SUMMARY NO(Kilometre).").Range("A70") = "Start"
rSource = Array(Sheets("IT116").Range("K7:R25"), _
Sheets("IT760").Range("A54:I71"), _
Sheets("IT134").Range("A47:I63"), _
Sheets("IT1272").Range("A50:I69"), _
Sheets("IT1500").Range("A51:I75"), _
Sheets("IT443").Range("A46:I58"), _
Sheets("IT835").Range("A44:I56"), _
Sheets("IT135").Range("A44:I55"), _
Sheets("IT148").Range("A30:I33"))
For i = 0 To UBound(rSource)
Set rTarget = Sheets("SUMMARY NO(Kilometre).").Range("A" & Rows.Count) _
.End(xlUp).Offset(1, 0)
rSource(i).Copy rTarget
Next i
End Sub
เหลือเฉพาะการนำ Duplicate ออกไป ช่วยอธิบายเพิ่มเติมว่ามีเงื่อนไขในการเช็ค Duplicate อย่างไรมาด้วยครับ
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sat Feb 18, 2012 11:04 pm
by yukioh

ขอบคุนครับ อาจาน ผมได้เอา Code ที่อาจานเขียนมาให้ไปใช้แล้ว มัน work ครับ
หลังจากที่เรา เอาข้อมูนมาจากแต่ละ ITxxx แล้ว มันจะมีข้อมูนที่ช้ำกันอยู ผมต้องกานที่จะเอาตัวที่ช้ากันออกไป เพระว้า ถ้าเราไม้เอาออก ก็จะกาຍเป็นว้า คณะ(department) นั้นใช้ ใช้รถยนต์ 2 ครั้ง, ฉะนั้น ผมจิ่งใช้ Excel 2007 Remove Duplicate ครับอาจาน
รบกวนอาจานด้วยครับ....
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sat Feb 18, 2012 11:08 pm
by snasui

ช่วยแนบไฟล์ตัวอย่างแสดงรายการซ้ำ โดย
ระบายสีรายการที่ซ้ำและต้องการให้เหลือเพียงรายการเดียวมาด้วยครับ จะได้เห็นว่าลักษณะการซ้ำเป็นอย่างไร จะได้เข้าใจตรงกันครับ
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 19, 2012 3:23 pm
by yukioh

นี้ครับ อาจา
รย์
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 19, 2012 5:14 pm
by snasui

ลองดูตัวอย่าง Code การ Remove Duplicate ตามด้านล่างครับ
Code: Select all
Sub RemoveDup()
Dim r As Range
Dim i As Integer
Dim iCount As Integer
With Sheets("SUMMARY NO(Kilometre).")
Set r = .Range("A71")
i = .Range("A" & Rows.Count).End(xlUp).Row
End With
iCount = 1
Do While iCount <= i
If Application.CountIf(r.Resize(iCount) _
, r(iCount)) > 1 Then
r(iCount).EntireRow.Delete
Else
iCount = iCount + 1
End If
Loop
End Sub
Re: ก่านคำนวน Millage (KM) กานใช้ลดยน
Posted: Sun Feb 19, 2012 11:13 pm
by yukioh

ขอบคุณมากมากครับอาจานที่ช่วยเหลือผมครับ ซาบซึ้งในสิ่งที่อาจารย์ช่วยเป็นอย่างยิ่ง