If formula based on month

rjwebgraphix

Well-known Member
Joined
May 25, 2010
Messages
590
Cell A4 is the 1st day of the month entered as 6/1/11, but formatted as mmmm. So it displays only the months name.

Cell B4 is just =A4, but only formatted as d.

Subsequent B cells B5, B6, B7 and so on are just =B4+1, =B5+1, =B6+1 and so on for 31 cells down.

These dates are used when calculating data that populates the rest of the spreadsheet in a macro, so have to stay as dates even though it looks like 1,2,3,4 etc.

I'm trying to weed out anything that would go on to the next month. So I'll need an if statement that says, If month has less than 31 days, and this date would go to the next month, then just display "-".

I hope that makes sense. I have a larger purpose for the formula in another column, but if I can understand this part, the other should be easy.

Thanks,

RJ
 

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,

Maybe this

Formula in B5
=IF(MONTH(B4+1)<>MONTH($A$4),"-",B4+1)
copy down

HTH

M.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

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