انتقل إلى المحتوى الرئيسي

كيفية البحث عن عدة قيم متطابقة في Excel وتسلسلها؟

كما نعلم جميعًا ، فإن VLOOKUP يمكن أن تساعدنا الوظيفة في Excel في البحث عن قيمة وإرجاع البيانات المقابلة في عمود آخر ، ولكن بشكل عام ، يمكنها فقط الحصول على القيمة النسبية الأولى إذا كانت هناك عدة بيانات مطابقة. في هذه المقالة ، سأتحدث عن كيفية البحث عن عدة قيم مقابلة وتسلسلها في خلية واحدة فقط أو قائمة عمودية.

Vlookup وإرجاع قيم مطابقة متعددة عموديًا مع الصيغة

Vlookup وسلسلة قيم مطابقة متعددة في خلية بوظيفة محددة بواسطة المستخدم

Vlookup وسلسلة قيم مطابقة متعددة في خلية باستخدام Kutools for Excel


لنفترض أن لدي النطاق التالي من البيانات ، للحصول على جميع القيم المقابلة بناءً على قيمة محددة عموديًا كما هو موضح في لقطة الشاشة التالية ، يمكنك تطبيق صيغة صفيف.

doc vlookup المتسلسلة 1

1. أدخل هذه الصيغة: =IF(COUNTIF($A$1:$A$16,$D$2)>=ROWS($1:1),INDEX($B$1:$B$16,SMALL(IF($A$1:$A$16=$D$2,ROW($1:$16)),ROW(1:1))),"") في خلية فارغة حيث تريد وضع النتيجة ، على سبيل المثال ، E2 ، ثم اضغط على كترل + شيفت + إنتر مفاتيح معًا للحصول على قاعدة القيمة النسبية بناءً على معيار معين ، انظر الصورة:

doc vlookup المتسلسلة 2

ملاحظات: في الصيغة أعلاه:

A1: A16 هو نطاق العمود الذي يحتوي على القيمة المحددة التي تريد البحث عنها ؛

D2 يشير إلى القيمة المحددة التي تريد البحث عنها ؛

B1: B16 هو نطاق العمود الذي تريد إرجاع البيانات المقابلة منه ؛

$ 1: $ 16 يشير إلى مرجع الصفوف داخل النطاق.

2. ثم حدد الخلية E2 ، واسحب مقبض التعبئة لأسفل إلى الخلايا حتى تحصل على خلايا فارغة ، ويتم سرد جميع القيم المطابقة في العمود كما هو موضح في لقطة الشاشة التالية:

doc vlookup المتسلسلة 3


بدلاً من الحصول على القيم النسبية عموديًا ، في بعض الأحيان ، تريد القيم المطابقة في خلية واحدة وربطها بفاصل معين. في هذه الحالة ، قد تقدم لك الوظيفة المحددة من قبل المستخدم خدمة.

1. اضغط باستمرار ALT + F11 مفاتيح لفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. انقر إدراج > وحدة، والصق الكود التالي في ملف وحدة نافذة او شباك.

رمز VBA: Vlookup وسلسلة قيم مطابقة متعددة في خلية

Function CusVlookup(lookupval, lookuprange As Range, indexcol As Long)
'updateby Extendoffice
Dim x As Range
Dim result As String
result = ""
For Each x In lookuprange
    If x = lookupval Then
        result = result & " " & x.Offset(0, indexcol - 1)
    End If
Next x
CusVlookup = result
End Function

3. ثم احفظ وأغلق هذا الرمز ، عد إلى ورقة العمل ، وأدخل هذه الصيغة: = cusvlookup (D2، A1: B16,2،XNUMX) في خلية فارغة حيث تريد وضع النتيجة ، واضغط على أدخل مفتاح ، تم إرجاع جميع القيم المقابلة بناءً على بيانات محددة في خلية واحدة مع فاصل مسافة ، انظر الصورة:

doc vlookup المتسلسلة 4

ملاحظات: في الصيغة أعلاه: D2 يشير إلى قيم الخلايا التي تريد البحث عنها ، أ 1: ب 16 هو نطاق البيانات الذي تريد جلب البيانات ، الرقم 2 هو رقم العمود الذي سيتم إرجاع قيمة المطابقة منه ، يمكنك تغيير مراجع الأطروحات حسب حاجتك.


إذا كان لديك كوتولس ل إكسيل، بما لديها الجمع بين الصفوف المتقدمة ميزة ، يمكنك إنهاء هذه المهمة بسرعة بكل سهولة. يمكن أن تساعدك هذه الميزة في دمج جميع القيم المطابقة مع محددات معينة بناءً على نفس البيانات في عمود آخر.

كوتولس ل إكسيل : مع أكثر من 300 وظيفة إضافية مفيدة في Excel ، يمكنك تجربتها مجانًا دون قيود في أيام 30.

بعد تثبيت كوتولس ل إكسيليرجى القيام بما يلي:

1. حدد نطاق البيانات الذي تريده للحصول على القيم المقابلة بناءً على البيانات المحددة.

2. ثم اضغط كوتولس > دمج وتقسيم > الجمع بين الصفوف المتقدمة، انظر لقطة الشاشة:

3. في الجمع بين الصفوف المتقدمة في مربع الحوار ، انقر فوق اسم العمود الذي تريد الدمج بناءً عليه ، ثم انقر فوق المفتاح الأساسي زر ، انظر لقطة الشاشة:

doc vlookup المتسلسلة 6

4. ثم انقر فوق اسم عمود آخر تريد إرجاع القيم المتطابقة ، وانقر فوق دمج لاختيار فاصل واحد لفصل القيم المجمعة ، انظر الصورة:

doc vlookup المتسلسلة 7

5. ثم انقر فوق Ok زر ، تم دمج جميع القيم المقابلة بناءً على نفس القيم مع فاصل معين ، انظر لقطات الشاشة:

doc vlookup المتسلسلة 8 2 doc vlookup المتسلسلة 9

 قم بتنزيل Kutools for Excel والإصدار التجريبي المجاني الآن!


كوتولس ل إكسيل: مع أكثر من 300 وظيفة إضافية مفيدة في Excel ، يمكنك تجربتها مجانًا دون قيود خلال 30 يومًا. تنزيل وتجربة مجانية الآن!

أفضل أدوات إنتاجية المكتب

🤖 مساعد Kutools AI: إحداث ثورة في تحليل البيانات على أساس: التنفيذ الذكي   |  إنشاء التعليمات البرمجية  |  إنشاء صيغ مخصصة  |  تحليل البيانات وإنشاء الرسوم البيانية  |  استدعاء وظائف Kutools...
الميزات الشعبية: البحث عن التكرارات أو تمييزها أو تحديدها   |  حذف الصفوف الفارغة   |  دمج الأعمدة أو الخلايا دون فقدان البيانات   |   جولة بدون صيغة 
سوبر بحث: معايير متعددة VLookup    VLookup ذات القيمة المتعددة  |   VLookup عبر أوراق متعددة   |   بحث غامض ....
قائمة منسدلة متقدمة: إنشاء القائمة المنسدلة بسرعة   |  القائمة المنسدلة التابعة   |  قائمة منسدلة متعددة التحديد ....
مدير العمود: إضافة عدد محدد من الأعمدة  |  نقل الأعمدة  |  تبديل حالة رؤية الأعمدة المخفية  |  مقارنة النطاقات والأعمدة 
الميزات المميزة: التركيز على الشبكة   |  عرض تصميم   |   شريط الفورمولا الكبير    مدير المصنفات والأوراق   |  مكتبة الموارد (النص السيارات)   |  منتقي التاريخ   |  اجمع أوراق العمل   |  تشفير/فك تشفير الخلايا    إرسال رسائل البريد الإلكتروني عن طريق القائمة   |  سوبر تصفية   |   مرشح خاص (تصفية غامق / مائل / يتوسطه خط ...) ...
أفضل 15 مجموعة أدوات12 نص الأدوات (إضافة نص, إزالة الأحرف، ...)   |   +50 رسم الأنواع (مخطط جانت، ...)   |   40+ عملي الصيغ (احسب العمر على أساس تاريخ الميلاد، ...)   |   19 إدخال الأدوات (أدخل رمز الاستجابة السريعة, إدراج صورة من المسار، ...)   |   12 تحويل الأدوات (أرقام إلى كلمات, نتيجة تحويل عملة، ...)   |   7 دمج وتقسيم الأدوات (الجمع بين الصفوف المتقدمة, تقسيم الخلايا، ...)   |   ... و اكثر

عزز مهاراتك في Excel باستخدام Kutools for Excel، واختبر كفاءة لم يسبق لها مثيل. يقدم Kutools for Excel أكثر من 300 ميزة متقدمة لتعزيز الإنتاجية وتوفير الوقت.  انقر هنا للحصول على الميزة التي تحتاجها أكثر...

الوصف


يجلب Office Tab الواجهة المبوبة إلى Office ، ويجعل عملك أسهل بكثير

  • تمكين التحرير والقراءة المبوبة في Word و Excel و PowerPointوالناشر والوصول و Visio والمشروع.
  • فتح وإنشاء مستندات متعددة في علامات تبويب جديدة من نفس النافذة ، بدلاً من النوافذ الجديدة.
  • يزيد من إنتاجيتك بنسبة 50٪ ، ويقلل مئات النقرات بالماوس كل يوم!
Comments (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is there any way to get the unique "name" for "class1"
This comment was minimized by the moderator on the site
Hello, sym-john,
Maybe the below article can solve your problem, please view it:
https://www.extendoffice.com/documents/excel/3381-excel-extract-unique-values-with-criteria.html
This comment was minimized by the moderator on the site
This is working great for me - is there anyway to change it that it checks if the cell contains rather than a complete match? Basically I have a list of tasks where:
Column A: Dependencies (eg 10003 10004 10008)
Column B: Task Reference (eg 10001)
Column C: Dependent Tasks (the column for the formula result) - where it would lookup the task reference to see which rows contain it in Column A, and then list the Task Reference of those tasks.

E.g:

Row | Column A | Column B | Column C
1 | | 10001 | 10002 10003
2 | 10001 | 10002 | 10003
3 | 10001 10002 | 10003 |
This comment was minimized by the moderator on the site
you would want to use the Instr() function which will check for something in a string of text in a cell. You can also use Left() and Right() if you are looking for the starting or ending details.
This comment was minimized by the moderator on the site
The cusVlookup worked great for me. Another way to have a different separator is to wrap in two substitute functions. The first (from inside to out) replaces the first space with no space, the second replaces all other spaces with a " / " in mine. Could use "," if you want commas.
=SUBSTITUTE(SUBSTITUTE(cusVlookup(D2,Table1,2)," ","",1)," "," / ")

Also, if your lookup value isn't the first column, you can use 0 or negative numbers to go to column to the left.
=SUBSTITUTE(SUBSTITUTE(cusVlookup(D2,Table1,-1)," ","",1)," "," / ")
This comment was minimized by the moderator on the site
Hi, jeff,
Thanks for your sharing, you must be a warmhearted man.
This comment was minimized by the moderator on the site
I have to say, I have been trying to get a formula for combining multiple values and returning them to a single cell for 2 days now. This "How To" has saved me!! Thank you SO much! I would never have gotten it without your Module!
I do have 2 questions though. I have the deliminator as a comma instead of a space and because of that it starts out with a comma. Is there a way to prevent the start comma but keep the rest?
My second question is; When I use the fill handle it changes the range values as well as the cell value I want to look up. I want it to continue to change the cell number I want to look up but keep the same range values. How can I make this happen?

Thank you so much for your help!!
This comment was minimized by the moderator on the site
Is there a way to delete the duplicate values in the concatenate?
This comment was minimized by the moderator on the site
Hello, Jacob,
May be the following article can help you to solve your problem.
https://www.extendoffice.com/documents/excel/3381-excel-extract-unique-values-with-criteria.html

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Is there a way to list the duplicate values only once, using the vba code and formula above? I am not sure where to put the countif>1 statement in the formula bar, or in the vba itself. Please help
This comment was minimized by the moderator on the site
you can add two extra condition to skip blank cells and to skip duplicates:For i = 1 To CriteriaRange.Count
If CriteriaRange.Cells(i).Value = Condition Then
If ConcatenateRange.Cells(i).Value <> "" Then 'SKIP BANKS
If InStr(xResult, ConcatenateRange.Cells(i).Value) = 0 Then 'SKIP IF FOUND DUPLICATE
xResult = xResult & Separator & ConcatenateRange.Cells(i).Value
End If
End If
End If
Next i
This comment was minimized by the moderator on the site
This is amazing but i am looking for something else, i have a table with RollNo StudentName sub1, sub2, sub3 ... Total Result, When I enter Rollnumber it should give a result like "SName Sub1 64, sub2 78,... Total 389, Result pass", is it possible
This comment was minimized by the moderator on the site
Loved the function for Excel 2013 but amended it slightly to change the separating character to ";" instead of " " and then remove the prefixed ";" from the concantenated values Results matching values in my example would have ;result01 or ;result01;result02 . Added the extra If Left(xResult, 1) = ";" to remove any extra ";" at the beginning of the string if it is the 1st character. I'm sure there is a neater way of doing it but it worked for me. :) Function CusVlookup(pValue As String, pWorkRng As Range, pIndex As Long) Dim rng As Range Dim xResult As String xResult = "" For Each rng In pWorkRng If rng = pValue Then xResult = xResult & ";" & rng.Offset(0, pIndex - 1) If Left(xResult, 1) = ";" Then xResult = MID(xResult,2,255) End If End If Next CusVlookup = xResult End Function
This comment was minimized by the moderator on the site
Make if condition for result if empty.

Function CusVlookup(lookupval, lookuprange As Range, indexcol As Long)
'updateby Extendoffice 20151118
Dim x As Range
Dim result As String
result = ""
For Each x In lookuprange
If x = lookupval Then
If Not result = "" Then
result = result & " " & x.Offset(0, indexcol - 1)
Else
result = x.Offset(0, indexcol - 1)
End If
Next x
CusVlookup = result
End Function
This comment was minimized by the moderator on the site
When using the cusvlookup is there a way to add the last name as well with a comma in between that might appear in Column C
This comment was minimized by the moderator on the site
How to get the result. Please help. data data1 result a 1 a1 b 2 a2 c b1 b2 c1 c2
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations