Solved

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

Posted on 2012-03-28
7
422 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now