Thep Excel

intersection – ฟังก์ชันหาข้อมูลที่ซ้ำกันระหว่างอาร์เรย์

intersection หาสมาชิกร่วมที่อยู่ในอาร์เรย์ทั้งสอง ฟังก์ชันนี้มีประโยชน์ในการค้นหาข้อมูลที่ตรงกัน เช่นลูกค้าร่วม หรือสินค้าที่ทั้งสองฝ่ายมี

=intersection(array1, array2)

By ThepExcel AI Agent
16 December 2025

Function Metrics


Popularity
5/10

Difficulty
4/10

Usefulness
5/10

Syntax & Arguments

=intersection(array1, array2)

Argument Type Required Default Description
array1 array Yes อาร์เรย์แรก
array2 array Yes อาร์เรย์ที่สอง

How it works

หาลูกค้าร่วม

หารายชื่อลูกค้าที่ซื้อจากทั้งสองแพลตฟอร์ม

หาสินค้าเหมือนกัน

หารายชื่อสินค้าที่มีอยู่ในสโตร์ทั้งสอง

Examples

ตัวอย่างที่ 1: หาสมาชิกร่วมพื้นฐาน
{{ intersection([1, 2, 3, 4], [3, 4, 5, 6]) }}
ฟังก์ชันหาสมาชิกร่วม [3, 4] ที่อยู่ในอาร์เรย์ทั้งสอง
n8n Formula:

={{ intersection([1, 2, 3, 4], [3, 4, 5, 6]) }}

Result:

[3, 4]

ตัวอย่างที่ 2: หาลูกค้าร่วม
{{ intersection($json.store1Customers, $json.store2Customers) }}
สูตรนี้หารายชื่อลูกค้าที่ซื้อจากทั้งสองสโตร์
n8n Formula:

={{ intersection($json.store1Customers, $json.store2Customers) }}

Result:

[customer_1, customer_3, customer_5, ...]

ตัวอย่างที่ 3: หาสินค้าเหมือนกัน
{{ intersection($node['Warehouse A'].json.items, $node['Warehouse B'].json.items) }}
ดึงรายชื่อสินค้าที่มีอยู่ในทั้งสองคลังสินค้า
n8n Formula:

={{ intersection($node['Warehouse A'].json.items, $node['Warehouse B'].json.items) }}

Result:

[item_1, item_2, ...]

FAQs

ลำดับของพารามิเตอร์ใน intersection() สำคัญหรือไม่?

ไม่ intersection() คืนค่าเดียวกัน ไม่ว่าลำดับจะเป็นอย่างไรก็ตาม

intersection() จะรับ duplicate ได้หรือ?

ได้ แต่ผลลัพธ์จะลบ duplicate อัตโนมัติ ถ้า array มี duplicate

ใช้ intersection() เมื่อไหร่ในการทำงาน?

ใช้เมื่อต้องการหาสมาชิกร่วม เช่นลูกค้าร่วม, สินค้าเหมือนกัน, หรือเพื่อค้นหาข้อมูลตรงกัน

Resources & Related

Additional Notes

intersection เป็นฟังก์ชันที่หาข้อมูลที่อยู่ในอาร์เรย์ทั้งสอง (ส่วนที่ซ้ำกัน) ใช้เมื่อต้องการหาสมาชิกร่วมระหว่างสองรายชื่อ

Leave a Reply

Your email address will not be published. Required fields are marked *