Empty cell if previous cell is the last day of the month

jasriel

New Member
Joined
Apr 7, 2016
Messages
16
Office Version
  1. 2019
Platform
  1. Windows
Hi everyone,

I cannot seem to find the answer to my particular problem, hence my post. So, I am making an excel spreadsheet for work. It has dates 1 to 31 and corresponding days to the dates. So for instance this month 9/1/21 should be a Wednesday. So I would have WE (day of the week) in one cell and 1 (day of the month) in the other cell. Now that being said when days end like this month at 30, I need the last cell to be blank, but if the month does have 31 days I need it to fill that day in accordingly. Same thing would be for February, if it is a leap year or simply a regular year with 28 days, I would need 29 (pending leap year), 30 and 31 to be empty. I have uploaded a picture of the spreadsheet I am working on, so simply enter the date on sheet 1. Then it will change the corresponding information on sheet 2. So the Month and Year at the top right of the sheet will change and the MO, TU, WE, TH, FR, SA, SU will change accordingly also. I am not sure how to upload the actual spreadsheet, but if anyone would like me to send it to them send me a PM on here and I will send it. I am posting this at work so I am unable to install anything to the computers, so using a mini-sheet is out of the question.

Anyway I hope someone has an idea how to accomplish this as I do not.

Thank you
 

Attachments

  • Capture.PNG
    Capture.PNG
    20.1 KB · Views: 28

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
ok the following formula assumes that the current month is in A1, and the formula can be in all of the cells or from column 28 onwards
it looks at the date in A1 and checks if by adding a day does the month change, if it changes then set the cell to empty, if no change in the month then increment the day by one, the first cell is set to 1

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
101/10/2021
2
312345678910111213141516171819202122232425262728293031
Sheet1
Cell Formulas
RangeFormula
B3:AE3B3=IF(A3="","",IF(MONTH($A$1)<>MONTH(DATE(YEAR($A$1),MONTH($A$1),DAY(A3)+1)),"",DAY(DATE(YEAR($A$1),MONTH($A$1),DAY(A3)+1))))
 
Upvote 0
MrExcel Playbook 02 2021-09.xlsm
AAABACADAEAFAGAHAI
1year2021
2month9
3
4
5
6FriSatSunMonTueWedThu 
724252627282930 
Sheet5
Cell Formulas
RangeFormula
AA6:AH6AA6=AA7
AA7:AE7AA7=Z7+1
AF7:AH7AF7=IF(MONTH(AE7+1)=MONTH(AE7),AE7+1,"")

I usually do this by comparing the months of the two dates.
For this reason the numbers of the days and the weekday names is easiest to stay dates. I just use custom number format to show the date the way I want it.
Custom number formats:
to show the day number only: dd
to show the abbreviated weekday name in US English: [$-en-US]ddd
 
Upvote 0
Upvote 0
@jasriel
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Hi everyone,

Thank you for the replies. As soon as I am back at work I will give each of them a shot and see which works best for what I am trying to accomplish. Then I will post an update.
 
Upvote 0
As soon as I am back at work I will give each of them a shot and see which works best for what I am trying to accomplish.
Unfortunately you didn't take up my suggestion about disclosing your Excel version. :(

IF you happen to have MS365 then perhaps this might be best as it only requires formulas in A6 and A7 (no copy across) and the cells over there on the right will take care of themselves.

21 09 19.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
6WETHFRSASUMOTUWETHFRSASUMOTUWETHFRSASUMOTUWETHFRSASUMOTUWETH
7123456789101112131415161718192021222324252627282930
Days
Cell Formulas
RangeFormula
A6:AD6A6=LEFT(UPPER(TEXT(EOMONTH(TODAY(),-1)+A7#,"ddd")),2)
A7:AD7A7=SEQUENCE(,DAY(EOMONTH(TODAY(),0)))
Dynamic array formulas.
 
Upvote 0
My apologies, when I did my earlier reply I was short on time and did not have a chance. I had a few more minutes right now and I updated the version I am using. Ty for the reminder. I will try all the solutions that have been suggested and see which one works best once I get back to work tonight.
 
Upvote 0
OK, no need to test mine then as it will not work with Excel 2019.

Thanks for updating your profile though. (y)
 
Upvote 0
Hi again everyone, I am trying all the replies and they work for what is being accomplished but I realize I forgot to state one thing in my original posting. I only need the days of the week that go past the last day of the month to be blank, the days of the month will always show as 1-31.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top