Excel column "A" more than Duplecate Names(in Different locations same Company Name),
Column "B" Person Name, Column "C" location Name. Column "D" Value. Column "E" %Value
Column "F" Date given.
Example:
XYZ C***ry
Company Name Person Lacation Value %Value Date
ABC Company aaaa Location1 Value1 %Value1 1/12/2022
ABC Company aaaa Location2 Value2 %Value2 1/14/2023
ABC Company bbbb Location3 Value3 %Value3 2/15/2023
CDE Company eeee Location4 Value4 %Value4 7/16/2023
EFG Company ffff Location5 Value5 %Value5 2/12/2022
EFG Company ffff Location6 Value6 %Value6 3/24/2023
I need This output for Dynamic selection below Output is Save in Separate Woksheet
Country Name Company Name Person Lacation Value %Value Date
XYZ C***ry ABC Company aaaa Location2 Value2 %Value2 1/14/2023
XYZ C***ry ABC Company bbbb Location3 Value3 %Value3 2/15/2023
XYZ C***ry CDE Company eeee Location4 Value4 %Value4 7/16/2023
XYZ C***ry EFG Company ffff Location6 Value6 %Value6 3/24/2023
What I have tried:
Sub AddData()
Dim LastRow As Long
LastRow = Sheets("Sheet2").Cells(Rows.Count, "B").End(xlUp).Row
Sheets("Sheet2").Range("A1:A" & LastRow).Value = "Data"
End Sub
For Each Row In selRange.Rows
If Row.Cells(1, 1) <> "" Then
Row.Offset(0, 3).Cells(1, 1) = Row.Cells(1, 1) + Row.Cells(1, 2)
End If
Next
' clear result range before filling
Set UniqueRange = Range(resultDataRange)
UniqueRange.Clear
Set UniqueRange = Range(resultKeyRange)
index = resultIndex ' see note above regarding dynamic range
For Each cell In UniqueRange.Rows
cell.Formula = "=IFERROR(INDEX(" + keyRange + _
", MATCH(0,INDEX(COUNTIF($D$8:D" + CStr(index) + _
"," + keyRange + "),0,0),0)), """")"
index = index + 1