I am struggling with a formula that will do the following:

If cell C4 = "Past 12 Months", sum all of the values in sheet 2 for that UFN
If cell C4 = "Past 6 Months", sum Jan to June in sheet 2 for that UFN
If cell C4 = "Past 3 Months", sum Apr to June in sheet 2 for that UFN

I hope this makes sense! I can get the IF formula part ok but I am struggling to figure out the Vlook up side of things.
test wb.xlsx
I have attached a sample workbook. Formula should be in the Value column (D4).

Thanks!