?
Solved

Show Jan 15 and July 15 of each year

Posted on 2014-09-24
15
Medium Priority
?
107 Views
Last Modified: 2014-09-24
Experts,

What would be the formula to show the next date of either Jan 15 or July 15?  
Example:  formula should return Jan 15, 2015 and then once that date is passed then will show July 15, 2015.

hope that makes sense.  Please ask to explain in more detail if need be.

thank you
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
  • 2
  • +1
15 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 total points
ID: 40341940
=DATE(YEAR(NOW()),CHOOSE(MONTH(NOW()),IF(DAY(NOW())>15,7,1),7,7,7,7,7,IF(DAY(NOW())>15,13,7),13,13,13,13,13),15)

Open in new window

0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40341944
type  

in A1  1/15/2015
and in A2 7/15/2015
select both of the cells and drag them down and you will see the series is created
0
 

Author Comment

by:pdvsa
ID: 40341986
Philip:  you are good.  

I have a simple follow up.  Would you mind to tell me how I could subtract 1 month and 15 days from that formula?  I tried and I dont really know where to put the criteria in such a long formula.   thank you

Professor: nice and simple.  I could make that work but would need a table and lookup.  I only am wanting a single cell that shows the date.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:pdvsa
ID: 40341987
thank you
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40341991
=DATE(YEAR(NOW()),CHOOSE(MONTH(NOW()),IF(DAY(NOW())>15,6,0),6,6,6,6,6,IF(DAY(NOW())>15,12,6),12,12,12,12,12),0)

Open in new window

0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40342015
Try this formula:

=EOMONTH(B2,IF(MONTH(B2)<7,6,12)-MONTH(B2))+15

Where B2 contains a date for comparison. If you want it to compare to today:

=EOMONTH(TODAY(),IF(MONTH(TODAY())<7,6,12)-MONTH(TODAY()))+15

EOMONTH creates a date for the End of Month, syntax is:

=EOMONTH(Date, Months)  where months is number of months forward (or back)

The comparison of month for TODAY with 6 or 12 determines how many months to go forward.

Thanks
Rob H
0
 

Author Comment

by:pdvsa
ID: 40342040
Rob: would that formula
=EOMONTH(TODAY(),IF(MONTH(TODAY())<7,6,12)-MONTH(TODAY()))+15

always return either the 15 of jan or july and not some other day (maybe the 16 or 14 etc etc)  because some months have 30, 31 days etc.
0
 

Author Comment

by:pdvsa
ID: 40342067
how would I modify to subtract a month and 15 days?  
=EOMONTH(TODAY(),IF(MONTH(TODAY())<7,6,12)-MONTH(TODAY()))+15
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40342074
It would always return the 15th of the month, except for flaw corrected with below:

=EOMONTH(TODAY(),IF(AND(DAY(TODAY())<16,OR(MONTH(TODAY())=1,MONTH(TODAY())=7)),-1,IF(MONTH(TODAY())<7,6,12)-MONTH(TODAY())))+15

EOMONTH always round to the last day of a month regardless of number of days, last day of a month plus 15 is always the 15th of the next month.

Correction was to overcome dates between 1st & 15th Jan or 1st & 15th July rounding up to the next occurence of 15th of Jan or July.

Thanks
Rob H
0
 

Author Comment

by:pdvsa
ID: 40342077
I dont think the above EOMONTH is subtracting out a month and 15 days but I see -MONTH in the formula so it looks like it should but the return is Jan 15, 2015 but shouldl be Nov 30 2014
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40342085
Do you want the 15th of Jan / 15th of July?

OR

Do you want 30th November (1 month & 15 days prior to 15th Jan) / 31 May (1 month & 15 days prior to 15th July)?

Thanks
Rob H
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40342110
Just to clarify, my post was posted before I realised the requirement to deduct 1 month and 15 days so the formula did not allow for that.

The -MONTH that you refer to was to calculate how many months to go forward to always end at Jan or July.

For example, currently in September, therefore
12 - MONTH(TODAY())
gives 12 - 9 = 3

leads to EOMONTH(TODAY(), 3) which gives end of December, then plus 15 gives 15 Jan.

Example prior to July (month 7) eg May

6 - MONTH(DateInMay)
6 - 5 = 1

leads to EOMONTH(DateInMay,1) which gives end of June, then plus 15 gives 15 July.

The 12 or the 6 in the above examples was determined by an IF statement based on current month being less than 7.

Thanks
Rob H
0
 

Author Comment

by:pdvsa
ID: 40342247
Rob thank you... Yes, u need the 15th only and no other date.
0
 

Author Comment

by:pdvsa
ID: 40342261
I need.. Typo from cell
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question