با سلام. من یک جدول از داده ها دارم.ردیف اول اسم افراده و در ردیف دوم مثلا تاریخ تولدشونه.میخوام اسم افرادی که تاریخ تولشون یه تاریخ مشخصه رو پشت سر هم تو یک سلول با کاما بهم نشون بده. لطفا راهنماییم کنید. ممنون.
جمع کردن متنها به صورت شرطی
Collapse
X
-
سلام
با وارد کردن کد زیر در محیط vba از تابع vlookupall استفاده کنید.vlookupall.rar
کد:Function vlookupall(sSearch As String, rRange As Range, _ Optional lLookupCol As Long = 2, Optional sDel As String = ",") As String 'Vlookupall searches in first column of rRange for sSearch and returns 'corresponding values of column lLookupCol if sSearch was found. All these 'lookup values are being concatenated, delimited by sDel and returned in 'one string. If lLookupCol is negative then rRange must not have more than 'one column. 'Reverse("moc.LiborPlus.www") PB 16-Sep-2010 V0.20 Dim i As Long, sTemp As String If lLookupCol > rRange.Columns.Count Or sSearch = "" Or _ (lLookupCol < 0 And rRange.Columns.Count > 1) Then vlookupall = CVErr(xlErrValue) Exit Function End If vlookupall = "" For i = 1 To rRange.Rows.Count If rRange(i, 1).Text = sSearch Then If lLookupCol >= 0 Then vlookupall = vlookupall & sTemp & rRange(i, lLookupCol).Text Else vlookupall = vlookupall & sTemp & rRange(i).Offset(0, lLookupCol).Text End If sTemp = sDel End If Next i End Function
کامنت
کامنت