Salman Khan
Salman Khan

Reputation: 15

Shortening the IF And Formula using Date Function

Below is my IF AND formula using dates.

=if(and(C4>= & DATE(2016,01,01),C4<= & 
DATE(2016,01,31)),"Jan",if(and(C4>= & DATE(2016,02,01),C4<= & 
DATE(2016,02,29)),"Feb",if(and(C4>= & DATE(2016,03,01),C4<= & 
DATE(2016,03,31)),"Mar",if(and(C4>= & DATE(2016,04,01),C4<= & 
DATE(2016,04,30)),"Apr",if(and(C4>= & DATE(2016,05,01),C4<= & 
DATE(2016,05,31)),"May",if(and(C4>= & DATE(2016,06,01),C4<= & 
DATE(2016,06,31)),"Jun",if(and(C4>= & DATE(2016,07,01),C4<= & 
DATE(2016,07,31)),"Jul",if(and(C4>= & DATE(2016,08,01),C4<= & 
DATE(2016,08,31)),"Aug",if(and(C4>= & DATE(2016,09,01),C4<= & 
DATE(2016,09,30)),"Sept",if(and(C4>= & DATE(2016,10,01),C4<= & 
DATE(2016,10,31)),"Oct",if(and(C4>= & DATE(2016,11,01),C4<= & 
DATE(2016,11,30)),"Nov",if(and(C4>= & DATE(2016,12,01),C4<= & 
DATE(2016,12,31)),"Dec",0))))))

Please help me in shortening this formula.

Thanks. Salman Khan

Upvotes: 0

Views: 43

Answers (1)

hackwithharsha
hackwithharsha

Reputation: 920

I hope, Below formula will resolve your problem

= TEXT(c4,"mmm")

Upvotes: 1

Related Questions