简体   繁体   中英

Computing quarterly total returns from daily data

I have an Excel file in which I am trying to create a daily report for the returns of an investment fund. The data I am aggregating in the spreadsheet is daily, but I need to be able to compute quarter-to-date returns. Therefore, I need a way for Excel to know when a quarter starts and ends, and which numbers to compute the quarter-to-date returns from.

Any ideas?

There is no quarter formula in excel but you can manipulate this by:

=roundup(month(A2)/3,0)

If your dates are found in column A (start from rows 2 due to header) then this formula will display the quarter of the date.

If you have an array of ordered dates, you can determine the end of the quarter by using the month function. One way would be to see if the month has changed from the previous row to the current row. That indicates a beginning of the month. Also, the quarter can be detected month is 1, 4, 7, and 10, with the mod function. This will result in true for the first day of quarter.

=AND(MONTH(A3)<>MONTH(A2),MOD(MONTH(A3),3)=1)

EDIT:

If the above equation is in column C, and the values you want a cumulative total on are in column B, then you can put the following equation in column C to calculate the cummulative total that is reset at the beginning of the quarter.

=IF(C3,B3,B3+D2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM