I've been struggling to write a formula to have a cell display the percentage for this month and like it, another cell that displays last month's percentage, auto-updating per month. I'm come up with a formula that works, but it's hideous coding.
=IF(MONTH(NOW())=11,H2,IF(MONTH(NOW())=12,H3,IF(MONTH(NOW())=1,H4,IF(MONTH(NOW())=2,H5,
IF(MONTH(NOW())=3,H6,IF(MONTH(NOW())=4,H7,IF(MONTH(NOW())=5,H8,IF(MONTH(NOW())=6,H9,
IF(MONTH(NOW())=7,H10,IF(MONTH(NOW())=8,H11,IF(MONTH(NOW())=9,H12,
IF(MONTH(NOW())=10,H13))))))))))))
Are there any simpler ways to do this? H2 and on is the list of values starting November '07 and on. The only coding I ever played with is "spaghetti code" Basic, and I guess old habits die hard. The code I used for last month is:
=IF(MONTH(NOW())-1=11,H2,IF(MONTH(NOW())-1=0,H3,IF(MONTH(NOW()-1)=1,H4,
IF(MONTH(NOW())-1=2,H5,IF(MONTH(NOW())-1=3,H6,IF(MONTH(NOW())-1=4,H7,
IF(MONTH(NOW())-1=5,H8,IF(MONTH(NOW())-1=6,H9,IF(MONTH(NOW())-1=7,H10,
IF(MONTH(NOW())-1=8,H11,IF(MONTH(NOW())-1=9,H12,
IF(MONTH(NOW())-1=10,H13))))))))))))
Obviously it will have to be rewritten every year.
Bookmarks