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

كيفية البحث لإرجاع قيم متعددة في خلية واحدة في إكسيل؟

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

Vlookup لإرجاع قيم متعددة في خلية واحدة باستخدام وظيفة TEXTJOIN (Excel 2019 و Office 365)

Vlookup لإرجاع قيم متعددة في خلية واحدة باستخدام وظيفة محددة من قبل المستخدم

Vlookup لإرجاع قيم متعددة في خلية واحدة بميزة مفيدة


Vlookup لإرجاع قيم متعددة في خلية واحدة باستخدام وظيفة TEXTJOIN (Excel 2019 و Office 365)

إذا كان لديك الإصدار الأعلى من Excel مثل Excel 2019 و Office 365 ، فهناك وظيفة جديدة - النص، مع هذه الوظيفة القوية ، يمكنك البحث بسرعة وإرجاع جميع القيم المتطابقة في خلية واحدة.

Vlookup لإرجاع جميع القيم المطابقة في خلية واحدة

الرجاء تطبيق الصيغة أدناه في خلية فارغة حيث تريد وضع النتيجة ، ثم اضغط كترل + شيفت + إنتر مفاتيح معًا للحصول على النتيجة الأولى ، ثم اسحب مقبض التعبئة لأسفل إلى الخلية التي تريد استخدام هذه الصيغة ، وستحصل على جميع القيم المقابلة كما هو موضح أدناه لقطة الشاشة:

=TEXTJOIN(",",TRUE,IF($A$2:$A$11=E2,$C$2:$C$11,""))

ملحوظة: في الصيغة أعلاه ، A2: A11 هل يحتوي نطاق البحث على بيانات البحث ، E2 هي قيمة البحث ، C2: C11 هو نطاق البيانات الذي تريد إرجاع القيم المتطابقة منه ، ","هو الفاصل لفصل السجلات المتعددة.

Vlookup لإرجاع جميع القيم المطابقة دون التكرارات في خلية واحدة

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

يرجى نسخ الصيغة التالية ولصقها في خلية فارغة ، ثم الضغط على كترل + شيفت + إنتر مفاتيح معًا للحصول على النتيجة الأولى ، ثم انسخ هذه الصيغة لملء الخلايا الأخرى ، وستحصل على جميع القيم المقابلة بدون القيم الموضحة أدناه:

=TEXTJOIN(",", TRUE, IF(IFERROR(MATCH($C$2:$C$11, IF(E2=$A$2:$A$11, $C$2:$C$11, ""), 0),"")=MATCH(ROW($C$2:$C$11), ROW($C$2:$C$11)), $C$2:$C$11, ""))

ملحوظة: في الصيغة أعلاه ، A2: A11 هل يحتوي نطاق البحث على بيانات البحث ، E2 هي قيمة البحث ، C2: C11 هو نطاق البيانات الذي تريد إرجاع القيم المتطابقة منه ، ","هو الفاصل لفصل السجلات المتعددة.

Vlookup لإرجاع قيم متعددة في خلية واحدة باستخدام وظيفة محددة من قبل المستخدم

لا تتوفر وظيفة TEXTJOIN أعلاه إلا لبرنامجي Excel 2019 و Office 365 ، إذا كان لديك إصدارات أقل من Excel ، فيجب عليك استخدام بعض الرموز لإنهاء هذه المهمة.

Vlookup لإرجاع جميع القيم المطابقة في خلية واحدة

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

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

كود VBA: Vlookup لإرجاع قيم متعددة في خلية واحدة

Function ConcatenateIf(CriteriaRange As Range, Condition As Variant, ConcatenateRange As Range, Optional Separator As String = ",") As Variant
'Updateby Extendoffice
Dim xResult As String
On Error Resume Next
If CriteriaRange.Count <> ConcatenateRange.Count Then
    ConcatenateIf = CVErr(xlErrRef)
    Exit Function
End If
For i = 1 To CriteriaRange.Count
    If CriteriaRange.Cells(i).Value = Condition Then
        xResult = xResult & Separator & ConcatenateRange.Cells(i).Value
    End If
Next i
If xResult <> "" Then
    xResult = VBA.Mid(xResult, VBA.Len(Separator) + 1)
End If
ConcatenateIf = xResult
Exit Function
End Function

3. ثم احفظ وأغلق هذا الرمز ، عد إلى ورقة العمل ، وأدخل هذه الصيغة: =CONCATENATEIF($A$2:$A$11, E2, $C$2:$C$11, ", ") في خلية فارغة محددة حيث تريد وضع النتيجة ، ثم اسحب مقبض التعبئة لأسفل للحصول على جميع القيم المقابلة في خلية واحدة تريدها ، انظر لقطة الشاشة:

ملحوظة: في الصيغة أعلاه ، A2: A11 هل يحتوي نطاق البحث على بيانات البحث ، E2 هي قيمة البحث ، C2: C11 هو نطاق البيانات الذي تريد إرجاع القيم المتطابقة منه ، ","هو الفاصل لفصل السجلات المتعددة.

Vlookup لإرجاع جميع القيم المطابقة دون التكرارات في خلية واحدة

لتجاهل التكرارات في القيم المطابقة التي تم إرجاعها ، يرجى القيام بالكود أدناه.

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

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

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

Function MultipleLookupNoRept(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer)
'Updateby Extendoffice
    Dim xDic As New Dictionary
    Dim xRows As Long
    Dim xStr As String
    Dim i As Long
    On Error Resume Next
    xRows = LookupRange.Rows.Count
    For i = 1 To xRows
        If LookupRange.Columns(1).Cells(i).Value = Lookupvalue Then
            xDic.Add LookupRange.Columns(ColumnNumber).Cells(i).Value, ""
        End If
    Next
    xStr = ""
    MultipleLookupNoRept = xStr
    If xDic.Count > 0 Then
        For i = 0 To xDic.Count - 1
            xStr = xStr & xDic.Keys(i) & ","
        Next
        MultipleLookupNoRept = Left(xStr, Len(xStr) - 1)
    End If
End Function

3. بعد إدخال الرمز ، انقر فوق الأدوات > مراجع حسابات في الفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة ، ثم في المنبثقة المراجع - VBAProject مربع الحوار ، تحقق وقت تشغيل البرمجة لـ Microsoft الخيار في المراجع المتاحة مربع القائمة ، انظر لقطات الشاشة:

4. ثم اضغط OK لإغلاق مربع الحوار ، وحفظ وإغلاق نافذة التعليمات البرمجية ، والعودة إلى ورقة العمل ، وإدخال هذه الصيغة: =MultipleLookupNoRept(E2,$A$2:$C$11,3) into a blank cell where you want to output the result, and then drag the fill hanlde down to get all matching values, see screenshot:

ملحوظة: في الصيغة أعلاه ، A2: C11 هو نطاق البيانات الذي تريد استخدامه ، E2 هي قيمة البحث ، الرقم 3 هو رقم العمود الذي يحتوي على القيم التي تم إرجاعها.

Vlookup لإرجاع قيم متعددة في خلية واحدة بميزة مفيدة

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

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

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

1. حدد نطاق البيانات الذي تريده لدمج بيانات عمود واحد استنادًا إلى عمود آخر.

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

3. في خرجت الجمع بين الصفوف المتقدمة صندوق المحادثة:

  • انقر فوق اسم عمود المفتاح المراد دمجه بناءً على ، ثم انقر فوق المفتاح الأساسي
  • ثم انقر فوق عمود آخر تريد دمج بياناته بناءً على عمود المفتاح ، وانقر فوق دمج لاختيار فاصل واحد لفصل البيانات المجمعة.

4. ثم اضغط OK زر ، وستحصل على النتائج التالية:

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


المزيد من المقالات ذات الصلة:

  • وظيفة VLOOKUP مع بعض الأمثلة الأساسية والمتقدمة
  • في Excel ، تعد وظيفة VLOOKUP وظيفة فعالة لمعظم مستخدمي Excel ، والتي تُستخدم للبحث عن قيمة في أقصى يسار نطاق البيانات ، وإرجاع قيمة مطابقة في نفس الصف من العمود الذي حددته. يتحدث هذا البرنامج التعليمي عن كيفية استخدام وظيفة VLOOKUP مع بعض الأمثلة الأساسية والمتقدمة في Excel.
  • إرجاع قيم مطابقة متعددة بناءً على معيار واحد أو عدة معايير
  • عادةً ما يكون البحث عن قيمة محددة وإرجاع العنصر المطابق أمرًا سهلاً بالنسبة لمعظمنا باستخدام وظيفة VLOOKUP. ولكن ، هل سبق لك أن حاولت إرجاع قيم مطابقة متعددة بناءً على معيار واحد أو أكثر؟ في هذه المقالة ، سأقدم بعض الصيغ لحل هذه المهمة المعقدة في Excel.
  • Vlookup وإرجاع قيم متعددة عموديًا
  • عادةً ، يمكنك استخدام وظيفة Vlookup للحصول على أول قيمة مقابلة ، ولكن في بعض الأحيان ، تريد إرجاع جميع السجلات المطابقة بناءً على معيار معين. في هذه المقالة ، سأتحدث عن كيفية البحث وإرجاع جميع القيم المطابقة عموديًا أو أفقيًا أو في خلية واحدة.
  • البحث وإرجاع قيم متعددة من القائمة المنسدلة
  • في Excel ، كيف يمكنك البحث عن عدة قيم مقابلة وإرجاعها من قائمة منسدلة ، مما يعني أنه عند اختيار عنصر واحد من القائمة المنسدلة ، يتم عرض جميع قيمه النسبية مرة واحدة. في هذه المقالة ، سأقدم الحل خطوة بخطوة.

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

🤖 مساعد 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 (43)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have created a problem.
"I" have combined a "Textjoin" end "Vlookup" to return multiple values in to one single cell.
My problem is that the formula have to have an exact value to look for and I want it to lookup an "almost" match or Partial match.

Example: I have made a schedule how we ate going to work and a D1 is working from 07:30-16:00. And to lookup D1 is not the problem, the problem is that my boss sometimes puts other stuff togeather with the D1... Like "D1 +" or "D1 meeting".
Since my formula only lookup "D1" it misses for example the "D1 +".

My formula (that I have gotten from the web) =TEXTJOIN(" och ";SANT;OM($B$3:$B$15=$C$22:$F$22;$A$3:$A$15;""))It´s in swedish so "SANT" is "TRUE" and "OM" is "IF".

How can I make the formula lookup all the cells that have some form of "D1" in it and return all those to the same cell?
No matter if it says "D1 +" or "D1 meeting" or whatever.
The reson I want this, is because the boss always leave "D1" but can add other text behind the "D1"... and just because of that, my boss messes up my formula.
This comment was minimized by the moderator on the site
Hi!
This is a great VBA-Code which could help me a lot.But when I start the Function MultipleLookupNoRept Excel crashs...I´ve got a Dataset with about 6.000 Rows (Excel 2013).... is this too much for the VBA Function?

Thanks!
This comment was minimized by the moderator on the site
Hello Mr.XXL,Sorry to hear that. The row limit for Excel 2013 is 1048576. Therefore, maybe the VBA code is the reason for the crash.
Anyway, I would love to offer you another VBA code for Vlookup To Return All Matching Values Without Duplicates Into One Cell. Please use the VBA code below:
Option Explicit

Function Lookup_concat(Search_string As String, _
Search_in_col As Range, Return_val_col As Range)

Dim i As Long
Dim temp() As Variant
Dim result As String
ReDim temp(0)

For i = 1 To Search_in_col.Count
If Search_in_col.Cells(i, 1) = Search_string Then
temp(UBound(temp)) = Return_val_col.Cells(i, 1).Value
ReDim Preserve temp(UBound(temp) + 1)
End If
Next

If temp(0) <> "" Then
ReDim Preserve temp(UBound(temp) - 1)
Unique temp
For i = LBound(temp) To UBound(temp)
result = result & " " & temp(i)
Next i
Lookup_concat = Trim(result)
Else
Lookup_concat = ""
End If

End Function

Function Unique(tempArray As Variant)

Dim coll As New Collection
Dim Value As Variant

On Error Resume Next
For Each Value In tempArray
If Len(Value) > 0 Then coll.Add Value, CStr(Value)
Next Value
On Error GoTo 0

ReDim tempArray(0)

For Each Value In coll
tempArray(UBound(tempArray)) = Value
ReDim Preserve tempArray(UBound(tempArray) + 1)
Next Value

End Function

After you insert this VBA code in the Module, please type the formula =Lookup_concat(E2,$A$2:$A$14,$C$2:$C$14) into a blank cell where you want to output the result, and then drag the fill hanlde down to get all matching values. Please see the file I uploaded in this comment. Hope it solves your problem. 
Sincerely,Mandy

This comment was minimized by the moderator on the site
Hi, Thanks so much this worked!I used it to pull dates, that populated in the serial number format (<span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;">Changing the format to short date format using =TEXT(A2,”mm/dd/yy”) OR =DATEVALUE(A2) are not working. Do you have any solutions?</span>
This comment was minimized by the moderator on the site
Thank you for the explanations, however the function 'MultipleLookupNoRept' does not work on my file, could you tell me if an error exists.
This comment was minimized by the moderator on the site
Hi, Hasnae,Please check if you miss the third step -  check Microsoft Scripting Runtime option in the Available References list box.

This comment was minimized by the moderator on the site
Thank you so much for the code. Is there a way I can use the code to look up multiple values from multiple sheets? I tried to combine your function with IFERROR function but it doesn't seem to work.
This comment was minimized by the moderator on the site
Can this be modified to place the sum of those values? Instead of (400 400 400 400 400 400), can it sum them to show (2400)?
This comment was minimized by the moderator on the site
How with HLookUp function?
This comment was minimized by the moderator on the site
thanks for the code. I have modified it to allow you to optionally specify your own separator, Default is " ", if you specify the separator as"#cr" it will insert a CR/LF so the values will be on a separate line in the cell. It only applies the separator if there are multiple values

Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long, Optional ByVal pSep As Variant)

' ### Returns multiple values from a table into 1 cell ###

' pValue is the key value to lookup

' WorkRng is the Table you want to look up

' pIndex is the column # for the values to be returned from the pWorkRng

' pSep (optional) is the separator to be used. if omitted then default is a space (it doesn't apply the separator for the 1st entry)

' if the separtor = "#cr" it will separate the values on different line in the cell

Dim rng As Range

Dim sSep As String

Dim xResult As String

Dim Item1 As Boolean

Item1 = True



If IsMissing(pSep) = True Then

sSep = vbCr

Else

If pSep = "#cr" Then

sSep = vbCrLf

Else

sSep = pSep

End If

End If



xResult = ""

For Each rng In pWorkRng

If rng = pValue Then

If Item1 Then

xResult = xResult & rng.Offset(0, pIndex - 1)

Item1 = False

Else

xResult = xResult & sSep & rng.Offset(0, pIndex - 1)

End If

End If

Next

MYVLOOKUP = xResult

End Function
This comment was minimized by the moderator on the site
Thank you for this, the line breaks are what i needed to top this formula off! Question, is there a way to modify the code so that two values are compared? For example, similar to what we see with index and match, can i look for Product and Quantity columns, and based on those parameters it outputs results from the Region Column?
This comment was minimized by the moderator on the site
Thanks a lot for this code, it is very helpful. Does anyone know away to sum the values in the cell to just have at total of them.
Cheers
This comment was minimized by the moderator on the site
Hello, James, to sum values based on the corresponding items, the following article may help you, please chek it:
https://www.extendoffice.com/documents/excel/1268-excel-combine-duplicate-rows-and-sum.html
This comment was minimized by the moderator on the site
I have a server, it has connected with multiple applications. I want to compare compare two column and get the related applications details for that server.

What is the command for that.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations