View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kalpesh[_2_] Kalpesh[_2_] is offline
external usenet poster
 
Posts: 15
Default Formula problem in code

Instead of writing macro, why dont you put formulas straight into your
excel sheet
For eg In the "Hourly rate" column on "Employee(s) pay" sheet you can
write formula
as below =VLOOKUP(A2,'Employee(s)'!A2:G4,7,FALSE)

Then, copy this cell & paste it in A3, A4 tilll the end
So, when you type the employee ID in column A - this formula will
evaluate & lookup & fetch the hourly rate from the next sheet & bring
it back here

If you want to handle #N/A scenario, you can write above formula in
this way
=IF(ISNA(VLOOKUP(A2,'Employee(s)'!A2:G4,7,FALSE)), "NOT FOUND",
VLOOKUP(A2,'Employee(s)'!A2:G4,7,FALSE))

Does this help ?

Kalpesh