Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-03-28
7
Medium Priority
?
429 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
[X]
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
  • 2
  • 2
7 Comments
 
LVL 101

Expert Comment

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

WHat formula is giving the error?

mlmcc
0
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 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 35

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 101

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

730 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