ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF formula (https://www.excelbanter.com/excel-worksheet-functions/161614-if-formula.html)

bmo

IF formula
 
I have a formula "=month(B2)+2" which works fine, but i have 2006 & 2007 data
next to eachother, SO...if I have 5/1/07 it responds with 7 instead of
19...whereas 5/1/06 returns 7 which is correct.

could I use an IF formula for this? the only thing is the IF formula only
allows 7 formulas where this might need 24; 1 for each month...

FSt1

IF formula
 
hi,
try something like this...
=IF(YEAR(NOW())=YEAR(A10),MONTH(A10),IF(YEAR(NOW() )-YEAR(A10)=1,MONTH(A10)+12,IF(YEAR(NOW())-YEAR(A10)=2,MONTH(A10)+24)))
you can string it out for 7 years.
change cell references to fit your data.

regards
FSt1

"bmo" wrote:

I have a formula "=month(B2)+2" which works fine, but i have 2006 & 2007 data
next to eachother, SO...if I have 5/1/07 it responds with 7 instead of
19...whereas 5/1/06 returns 7 which is correct.

could I use an IF formula for this? the only thing is the IF formula only
allows 7 formulas where this might need 24; 1 for each month...


vezerid

IF formula
 
=12*(YEAR(B2)-2006)+MONTH(B2)+2

HTH
Kostis Vezerides

On Oct 10, 8:00 pm, bmo wrote:
I have a formula "=month(B2)+2" which works fine, but i have 2006 & 2007 data
next to eachother, SO...if I have 5/1/07 it responds with 7 instead of
19...whereas 5/1/06 returns 7 which is correct.

could I use an IF formula for this? the only thing is the IF formula only
allows 7 formulas where this might need 24; 1 for each month...





All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com