Comment find deux données de colonne Si, si vous trouvez, la troisième colonne pour find datatables

Retrouvez l'image que vous findez toutes les informations désolé pour ne pas pouvoir expliquer dans ma parole, mais j'explique en image, aidez-moi, merci de vous requestr

entrez la description de l'image ici

Alors j'ai essayé de suivre votre photo, j'ai eu le même problème et pour cela j'utilise cette fonction.

Vous devriez donc mettre les deux codes dans le même module. Je respecte également les colonnes que vous avez montrées sur la photo.

J'espère que cela vous aidera.

MODIFIER:

Sub test() Dim Lastrow As Long Dim cell As Range Dim rng As Range Dim Lastrow2 As Long, Lastrow3 As Long With ThisWorkbook.Worksheets("Sheet1") Lastrow = Application.Max(.Cells(.Rows.count, "A").End(xlUp).Row) .Range("B2:B" & Lastrow).Value = .Range("A2:A" & Lastrow).Value For Each cell In .Range("B2:B" & Lastrow) If cell.Value = "" Then If rng Is Nothing Then Set rng = cell Else Set rng = Union(rng, cell) End If End If Next If Not rng Is Nothing Then rng.Delete Shift:=xlUp End With Lastrow2 = Range("B" & Rows.count).End(xlUp).Row Lastrow3 = Range("E" & Rows.count).End(xlUp).Row For i = 2 To Lastrow2 Range("G" & i) = Range("B" & i) & " " & LookUpConcat(Range("B" & i), Range("D1:" & "D" & Lastrow3), Range("E1:" & "E" & Lastrow3), ",") Next i End Sub 

Voici la fonction:

 Function LookUpConcat(ByVal SearchSsortingng As Ssortingng, SearchRange As Range, ReturnRange As Range, _ Optional Delimiter As Ssortingng = " ", Optional MatchWhole As Boolean = True, _ Optional UniqueOnly As Boolean = False, Optional MatchCase As Boolean = False) Dim X As Long, CellVal As Ssortingng, ReturnVal As Ssortingng, Result As Ssortingng If (SearchRange.Rows.count > 1 And SearchRange.Columns.count > 1) Or _ (ReturnRange.Rows.count > 1 And ReturnRange.Columns.count > 1) Then LookUpConcat = CVErr(xlErrRef) Else If Not MatchCase Then SearchSsortingng = UCase(SearchSsortingng) For X = 1 To SearchRange.count If IsError(SearchRange(X)) Then GoTo Continue If MatchCase Then CellVal = SearchRange(X).Value Else CellVal = UCase(SearchRange(X).Value) End If ReturnVal = ReturnRange(X).Value If MatchWhole And CellVal = SearchSsortingng Then If UniqueOnly And InStr(Result & Delimiter, Delimiter & ReturnVal & Delimiter) > 0 Then GoTo Continue Result = Result & Delimiter & ReturnVal ElseIf Not MatchWhole And CellVal Like "*" & SearchSsortingng & "*" Then If UniqueOnly And InStr(Result & Delimiter, Delimiter & ReturnVal & Delimiter) > 0 Then GoTo Continue Result = Result & Delimiter & ReturnVal End If Continue: Next LookUpConcat = Mid(Result, Len(Delimiter) + 1) End If End Function