Jump to content

This topic is 8070 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi everyone!

I have a text field which also contains a date. I need to move the date to its own field (ServiceDate) but I'm having trouble pulling it from existing text. I tried using Substitute(Description, " ", "-") to at least separate the description from the date (so I could then pull it easier), but it substitues the three spaces with three dashes crazy.gif I've considered LeftWord, RightWord, Left, Right, and Replace but can't figure out how to handle it. Does anyone have any suggestions?

Existing data is:

W/H 5% LCARE 05/24

MED/ADJ

INS # 67081584 05/30

Pers Check #1751

INS # 2617 07/26

The above data doesn't reflect that there are three spaces between the 'description' and the date. Everything I think of trying, doesn't take into account that the description also has spaces and variable lengths. The date at the end of some fields needs to be moved. Help!!

LaRetta

Posted

hi LaRetta,

I'm I missing something obvious here?

What Date????

Existing data is:

W/H 5% LCARE 05/24

MED/ADJ

INS # 67081584 05/30

Pers Check #1751

INS # 2617 07/26

I see what could be three dates, but no years. What date are you referring to, or are you wanting all three dates out?

I think you might be able to pull them out, but I think we need more information on what you want.

Lee

tongue.gif

Posted

Hi Lee,

Each line listed is a separate record. The date I need to pull is at the end, displayed as 5/24 etc. They all represent year 2002. I hope this helps!

LaRetta

Posted

You can do this with one calculation with the result of Text, and two will take the text and make it a date.

See sample attached

Posted

Hi Razumovsky!!

Oh that worked perfectly, thanks so much! Left(Right ? I'm have to study this one for a bit to figure out WHY it worked, however! confused.gif I appreciate your help very much.

Hi Lee smile.gif

Well, I'm sure your solution would have worked perfectly also; however, I can't figure out how to open .sit files crazy.gif I appreciate you taking the time to respond though!

LaRetta

Posted

Hi L.

Right(Textfield,3) returns the last 3 characters in a text field

Left(Right(Textfield,3),1) returns the first character of the last 3

Lee's idea (I believe) was that you would then want to define a second calc field that was texttodate(firstcalc) to convert the info into true date format.

Keep in mind that this is based on the assumption that all your data is in the format of one of the 5 lines you posted. For example, if line 2 was:

MED/AD

the calc would return ED/AD/02

and if the date was embedded in the text (not at the end) you would need a different calc.

Cheers

Posted

Oh thanks so much for explaining. Yes, I used TextToDate to then convert it. The formulae was perfect. Is there any way of modifying this calc to then 'remove' that same information from the text field?

LaRetta

Posted

I think you would use a second calc field:

Case(Left(Right(textfield,3),1) = "/", Left( textfield , Length(textfield)-6 ), textfield)

Left( textfield , Length(textfield)-6 takes 6 characters off the end of the total length of the textfield (5 for the date, 1 for the space preceeding the date).

Cheers

Posted

Hi LaRetta,

I believe that Stuffit makes an expander for windows, if not, I pretty sure there are some free utilities out there that will open them.

In the mean time, Here is a zip file.

Lee smile.gif

Right.fp5.zip

Posted

Hi,

I'm concerned that your suggestion will strip text from fields without a date?? confused.gif

Hi Lee! I downloaded your file - thanks much! I had considered your formulae, but Right(Text, 4) & "/2002" also changes the "MED/ADJ" line to "/ADJ/2002". crazy.gif

LaRetta

Posted

Thats why you have the Case(Left(Right(Textfield,3),1) = "/" part. this only triggers the 6 character removal if there is a "/" as the 3rd to last character, presumably a feature unique to your records with dates at the end of the text.

This topic is 8070 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.