So I have a table that I created a query from and the fields that I pulled into that query are Name and each month of the year (i.e. July, August, etc.) and the year is a fiscal year beginning in July and ending in June I also created a calculated field that gives me the date in the three letter month format (i.e. "Mar") so for any day between 3/1/16 and 3/31/16 every row contains "Mar" in it and when the date changes to 4/1/2016 that field will contain "APR" and so on. My name field contains employee names and my month fields contain their monthly pay. I want to create a calculated field in that same query that says If the Date field says MAR then sum the July field thru February field and if it says APR then sum July thru March and so on. I have tried a similar formula that does not work, probably because it is to complex. As you can probably tell I have no idea what I am doing
IIf([Date]="AUG",[JUL],IIf([Date]="SEP",[JUL]+[AUG],IIf([Date]="OCT",[JUL]+[AUG]+[SEP],IIf([Date]="NOV",[JUL]+[AUG]+[SEP]+[OCT],IIf([Date]="DEC",[JUL]+[AUG]+[SEP]+[OCT]+[NOV],IIf([Date]="JAN",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC],IIf([Date]="FEB",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC]+[JAN],IIf([Date]="MAR",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC]+[JAN]+[FEB],IIf([Date]="APR",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC]+[JAN]+[FEB]+[MAR],IIf([Date]="MAY",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC]+[JAN]+[FEB]+[MAR]+[APR],IIf([Date]="JUN",[JUL]+[AUG]+[SEP]+[OCT]+[NOV]+[DEC]+[JAN]+[FEB]+[MAR]+[APR]+[MAY],[JUL:JUN])))))))))))