#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bmo bmo is offline
external usenet poster
 
Posts: 7
Default 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...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default 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...

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 751
Default 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...



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"