Pestomania

Board Regular
Joined
May 30, 2018
Messages
156
Hello.

I have cells that contain dates in the following formats:

"9/13-"
"9/13-9/14"
"-9/14"

What I am trying to determine is if I can force the "hyphen" into the cell. So if I type:

"9/13"

The format will auto-update to:

"9/13-"

I formulas that are based on that "-" being there.

How can I do this if someone forgets to place the hyphen?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,347
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Given the formats you showed us, how do you know the missing dash belongs at the end instead of at the beginning? Since you would need event code to do what you asked, wouldn't it be better to have that code stop the user and pop up a MessageBox advising them that their entry is missing the required dash? Would that approach be acceptable?
 
Last edited:

Pestomania

Board Regular
Joined
May 30, 2018
Messages
156
Hi Rick.

Thank you for replying so quick.

I was just playing around with the formats for a few minutes and when I changed it just text, everything worked fine. With or without a dash.

My other formulas would read (without dash) the date as a value, rather than as "9/13". I changed it to text and it accepted the "9/13" as that and returned the same.

Thank you!
 

Forum statistics

Threads
1,141,312
Messages
5,705,682
Members
421,406
Latest member
kluna90

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
Top