Hi All,
I am very new to VBA trying to solve a automation problem,
I have 2 datasets (A & B), A is the main database used for analysis and the B is the reference for the gaps.
A dataset has a column containing salaries (but no detailing to it)
B dataset has salary seperated by their experience level. Like '0-2 yrs', '2-5' etc.,
I need to apply some logic and compare the A dataset salary with B and derive at the experience level salaries for A.
A
Profile Median Salary
AC Mechanic 15000
Accounts executive 24000
IT recruiter 20000
b
AC Mechanic 0-2 13000
2-5 18000
5-8 21000
Accounts executive 0-2 15000
2-5 19000
5-8 22000
I have 3 levels to cross to check for this (sector, profile and city)
1. First it has to match the sector then profile then city and then the salary (tolerance level could be 20-30%)
Sub expauto()
tlastrow = Sheets("Teamlease").Cells(Rows.Count, "A").End(xlUp).Row
nlastrow = Sheets("Naukri").Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To tlastrow
For j = 2 To nlastrow
If Sheets("Teamlease").Range("A" & i) = Sheets("Naukri").Range("A" & j) Then
For k = 2 To tlastrow
For l = 2 To nlastrow
If Sheets("Teamlease").Range("B" & k) = Sheets("Naukri").Range("B" & l) Then
For m = 2 To tlastrow
For n = 2 To nlastrow
If Sheets("Teamlease").Range("C" & m) = Sheets("Naukri").Range("C" & n) Then
For o = 2 To tlastrow
For p = 2 To nlastrow
If Sheets("Teamlease").Range("D" & o) <= 0.2 * Sheets("Naukri").Range("F" & p) Then
Sheets("Teamlease").Range("E" & o) = Sheets("Naukri").Range("D" & p)
End If
Next p
Next o
End If
Next n
Next m
End If
Next l
Next k
End If
Next j
Next i
End Sub
Please verify this code and help me out with where I went wrong.
Or someone could code for the requirement, it would be grateful.
Thanks
Bookmarks