Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range Formula

Status
Not open for further replies.

mvalley

Technical User
Mar 4, 2011
80
US
I have a report that has a field,(cr_prdate) that may have a single date or a date range.

How would I create a formula that would display the date range of the records I am displaying (ie for single date 1/2/2015 or for weekend from 1/2/2015 - 1/4/2015) as a header formula.

Thanks for any suggestions offered.
 
Normally I have two formulas one - i.e., minimum({cr_prdate}) the second one maximum({cr_prdate}). Stick these two formulas in a text box with my other header text.

I hope this helps.
 
Works great thank you. My only issue is to create a formula that would display only the Minimum date if the minimum and maximum dates are the same (example, both dates would be 01/02/2015 verses 01/02/2015 - 01/04/2015. I think it would be and if, then,else formula, but I am having trouble getting it to work.
 
if minimum({cr_prdate}) = maximum({cr_prdate}) then
minimum({cr_prdate})​
else
minimum({cr_prdate})+ ' - ' +maximum({cr_prdate})​

I would believe this would work.
 
I too thought this would work, but I am getting an error message saying that a number is required
where'-' is in the formula. Still trying other options. Thank you
 
After the else, try replacing the + with & :

minimum({cr_prdate}) & ' - ' & maximum({cr_prdate})
 
Still not working, error message now shows the entire string, minimum({cr_prdate}) & ' - ' & maximum({cr_prdate}) with the message: "a date time is required
 

Try
if minimum({cr_prdate}) = maximum({cr_prdate}) then
totext(minimum({cr_prdate}))
else
totext(minimum({cr_prdate}))+ ' - ' +totext(maximum({cr_prdate}))

 
Thank you, but I am getting the error message on the ' - ' that a number is required here. Sorry this is so frustrating!!
 
Did you add totext twice in the last line (to both mimimum and maximum)? I believe it should work.
Try & instead of +
 
Thank you all for your assistance. BettyJ's suggestion of the ToText and changing + to & created an error free formula. Always appreciate the wonderful, and quick assistance I receive from this forum. Mary
 
Can you check and see if it works if you change & to +.
 
Brain fart earlier, I knew I needed the totext, sorry I did not catch it before I posted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top