The correct answer is: D. No error
The sentence “If I had known this yesterday, I will have helped him” is grammatically correct. The use of the past perfect tense “had known” indicates that the action of knowing took place before another past action, in this case, the action of helping. The use of the future perfect tense “will have helped” indicates that the action of helping will take place before a specific time in the future, in this case, before the time of speaking.
The other options are incorrect because they do not use the correct tenses. Option A, “If I had known this yesterday, I will help him,” uses the simple present tense “will help,” which is incorrect because it does not indicate that the action of helping will take place before a specific time in the future. Option B, “If I had known this yesterday, I would have helped him,” uses the past perfect subjunctive “would have helped,” which is incorrect because it is used to express a wish or possibility, not a certainty. Option C, “If I had known this yesterday, I will have helped him yesterday,” uses the future perfect tense “will have helped” twice, which is incorrect because it is redundant.