remove date if it goes over current month chosen

oblix

Board Regular
Joined
Mar 29, 2017
Messages
183
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Sorry for poor Heading but was not sure to call it.

In cell a1 I have a date (month and year)

in row 5 starting from column b I have dates from 1 to 31. I used formula to populate dates from 1 to 31.
the problem comes in when a month has 28, 29,30 days that means that in the last three columns the dates goes over to the next month.
Is there a formula I can use to make those cells blank if it goes over to next month. (feb ends in 28 and theefore the rest of the column dates needs to be blank)
hope the explanation was clear enought
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi,

Assuming you have a Real Date in A1.

Use B5 formula copied across if you Only need a number representing the day of the month.
Use B6 formula copied across if you Require Real Dates. You can format this row as d to the day Only, if you like.

Cell Formulas
RangeFormula
B5:AF5B5=IF(COLUMNS($B5:B5)>DAY(EOMONTH($A1,0)),"",COLUMNS($B5:B5))
B6:AF6B6=IF(COLUMNS($B5:B5)>DAY(EOMONTH($A1,0)),"",EOMONTH($A1,-1)+COLUMNS($B5:B5))
 
Upvote 0
Solution
Wow that totally worked
Thank you for quick response
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

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