![]() |
formula for month that is prior to actual
i generate reports for data collected from the previous month (i.e. in
december, i report for november's data). how do i formulate in my reports the date to show the previous month and year (while automatically updating according to excel date and time)? |
formula for month that is prior to actual
One way
=TEXT(DATE(YEAR(TODAY()),MONTH(TODAY()),0),"MMM YYYY") -- Regards, Peo Sjoblom "braadi" wrote in message ... i generate reports for data collected from the previous month (i.e. in december, i report for november's data). how do i formulate in my reports the date to show the previous month and year (while automatically updating according to excel date and time)? |
formula for month that is prior to actual
=DATE(IF(MONTH(NOW())=1,YEAR(NOW())-1,YEAR(NOW())),
IF(MONTH(NOW())=1,12,MONTH(NOW())-1), 28) This might be easier to follow if you store intermediate results in cells: A1: =IF(MONTH(NOW())=1,12,MONTH(NOW())-1) A2: =IF(A1=12,YEAR(NOW())-1, YEAR(NOW))) =Date(A2, A1, 28) This assumes that you put the DATE function in a cell formatted to show mm/yyyy. In that case, the day arg to the DATE function is arbitrary and can be any day number which appears in every month (i.e. 1-28). -- Ted |
formula for month that is prior to actual
great. thanks so much.
"TedMi" wrote: =DATE(IF(MONTH(NOW())=1,YEAR(NOW())-1,YEAR(NOW())), IF(MONTH(NOW())=1,12,MONTH(NOW())-1), 28) This might be easier to follow if you store intermediate results in cells: A1: =IF(MONTH(NOW())=1,12,MONTH(NOW())-1) A2: =IF(A1=12,YEAR(NOW())-1, YEAR(NOW))) =Date(A2, A1, 28) This assumes that you put the DATE function in a cell formatted to show mm/yyyy. In that case, the day arg to the DATE function is arbitrary and can be any day number which appears in every month (i.e. 1-28). -- Ted |
formula for month that is prior to actual
i appreciate the help so much. look forward to getting this working now.
"Peo Sjoblom" wrote: One way =TEXT(DATE(YEAR(TODAY()),MONTH(TODAY()),0),"MMM YYYY") -- Regards, Peo Sjoblom "braadi" wrote in message ... i generate reports for data collected from the previous month (i.e. in december, i report for november's data). how do i formulate in my reports the date to show the previous month and year (while automatically updating according to excel date and time)? |
All times are GMT +1. The time now is 10:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com