ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If, then, else question. (https://www.excelbanter.com/excel-worksheet-functions/75581-if-then-else-question.html)

MAB

If, then, else question.
 
This is my dilema... I need to display a status of 1 month previous and 2
months previous.

My problem arises in January and February. What I need in the statement for
current month - 1 is: If month(today()) = 1, then 12, else month(today())-1.
What I need for the statement current month -2 is: If(month(today()) = 1,
then 11, If month(today())= 2, then 12, else month(today())-2. I'm just not
certain how to write this in Excel.

Thank you.


bpeltzer

If, then, else question.
 
=if(month(today())<3,month(today())+10,month(today ())-2) is one way.
If you want to use nested ifs:
=if(month(today())=1,11,if(month(today())=2,12,mon th(today())-2)))
In general:
=if(condition_1,cond_1_value,if(condition_2,cond_2 _value,neither_value))

"MAB" wrote:

This is my dilema... I need to display a status of 1 month previous and 2
months previous.

My problem arises in January and February. What I need in the statement for
current month - 1 is: If month(today()) = 1, then 12, else month(today())-1.
What I need for the statement current month -2 is: If(month(today()) = 1,
then 11, If month(today())= 2, then 12, else month(today())-2. I'm just not
certain how to write this in Excel.

Thank you.


Bob Phillips

If, then, else question.
 
=CHOOSE(MONTH(TODAY()),12,1,2,3,4,5,6,7,8,9,10,11)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"MAB" wrote in message
...
This is my dilema... I need to display a status of 1 month previous and 2
months previous.

My problem arises in January and February. What I need in the statement

for
current month - 1 is: If month(today()) = 1, then 12, else

month(today())-1.
What I need for the statement current month -2 is: If(month(today()) =

1,
then 11, If month(today())= 2, then 12, else month(today())-2. I'm just

not
certain how to write this in Excel.

Thank you.




MAB

If, then, else question.
 
Perfect!

Thank you.

"bpeltzer" wrote:

=if(month(today())<3,month(today())+10,month(today ())-2) is one way.
If you want to use nested ifs:
=if(month(today())=1,11,if(month(today())=2,12,mon th(today())-2)))
In general:
=if(condition_1,cond_1_value,if(condition_2,cond_2 _value,neither_value))

"MAB" wrote:

This is my dilema... I need to display a status of 1 month previous and 2
months previous.

My problem arises in January and February. What I need in the statement for
current month - 1 is: If month(today()) = 1, then 12, else month(today())-1.
What I need for the statement current month -2 is: If(month(today()) = 1,
then 11, If month(today())= 2, then 12, else month(today())-2. I'm just not
certain how to write this in Excel.

Thank you.


mphell0

If, then, else question.
 

Load Analysis Toolpak and use this

for 1 month prior:
=MONTH(EDATE(TODAY(),-1))

for 2 months prior:
=MONTH(EDATE(TODAY(),-2))


--
mphell0
------------------------------------------------------------------------
mphell0's Profile: http://www.excelforum.com/member.php...o&userid=30153
View this thread: http://www.excelforum.com/showthread...hreadid=519486


Ardus Petus

If, then, else question.
 
This will automatically adjust to December 2005 if Today is January 2006

=DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY()))

HTH
--
AP

"MAB" a écrit dans le message de
...
This is my dilema... I need to display a status of 1 month previous and 2
months previous.

My problem arises in January and February. What I need in the statement

for
current month - 1 is: If month(today()) = 1, then 12, else

month(today())-1.
What I need for the statement current month -2 is: If(month(today()) =

1,
then 11, If month(today())= 2, then 12, else month(today())-2. I'm just

not
certain how to write this in Excel.

Thank you.





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

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