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
Solved

concatenate a date field part 2 Got a message "Bad Number format String"

Posted on 2012-03-28
7
424 Views
Last Modified: 2012-05-10
Thanks for the solution to ID 27652324 but now I want to use those results to create a formula that will subtact one year from the '201010'  to  '200910'.  I used a formula called "last year"  "Year ({?Selected_Date}) - 1"  got 2009, great  then tried to build  formula "totext({@Last year}, "yyyy")&ToText ({?Selected_Date}, "MM")  to build the '200910' but I got Bad Number format".  I am trying to use the parameter input date (10/23/2010) keyed in by the user to
select and compare employment counts in 2010 verus the same period 2009.

Can you point me in the right direction, again?  Thank you in advance.
0
Comment
Question by:Renshi04
  • 2
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37778782
WHat do you mean by period?

WHat formula is giving the error?

mlmcc
0
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
ID: 37780486
The problem is that in totext({@Last year}, "yyyy"), the "yyyy" format is to output the year from a date/datetime, but your {@Last year} formula is just a number (the year from {?Selected_Date}).  It's the same as saying ToText (2009, "yyyy"), and since 2009 is just a number, and "yyyy" is a date/datetime format, you get the "bad number format" error.

 You could fix this by changing the second formula to:

ToText ({@Last year}, "#") & ToText ({?Selected_Date}, "MM")

 The "#" format string is just a shorthand way of saying "no thousands separator and no decimal places").

 Or, for a slightly more direct solution, you could forget the {@Last year} formula and just subtract 1 from the year in that formula:

ToText (Year ({?Selected_Date}) - 1, "#") & ToText ({?Selected_Date}, "MM")


 James
0
 

Author Comment

by:Renshi04
ID: 37837557
Thanks, the user ask the wrong question.
0
 
LVL 34

Expert Comment

by:James0628
ID: 37841310
FWIW, I don't see how mlmcc's post is the solution to your question.  I think I did answer your question, but if the question was "wrong" somewhow, maybe you should just ask to have it deleted.

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37843366
Agree.  James seems to have answered the question that was asked.  If you haven't tried the solution you should.

Since the answer selected is obbviously not the solution I have unaccepted the comment.

mlmcc
Zone Advisor
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 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