Tags: currency, displays, excel, format, guys, microsoft, msdn, software, somyvar, totalcost, value, variable, whyif

Currency Format

On Microsoft » Microsoft Excel

3,555 words with 5 Comments; publish: Thu, 05 Jun 2008 09:21:00 GMT; (30662.01, « »)

Hi Guys,

Can someone tell me why?

If I set a variable Like so:

MyVar = Format(TotalCost, "###,##0.00")

If the value is 5,241.60 it displays as 5,241.60 but if its 10,483.20 it

displays as 10,483.2 missing the final 0 (zero)

As always, your help is appreciated.

Best Regards,

Steve.

All Comments

Leave a comment...

  • 5 Comments
    • Always Learning wrote:

      > Hi Guys,

      > Can someone tell me why?

      > If I set a variable Like so:

      > MyVar = Format(TotalCost, "###,##0.00")

      > If the value is 5,241.60 it displays as 5,241.60 but if its 10,483.20 it

      > displays as 10,483.2 missing the final 0 (zero)

      > As always, your help is appreciated.

      > Best Regards,

      > Steve.

      >

      Wow that is strange

      I tried the above and it worked fine for me (no missing zeros)

      Perhaps its something to do with where you are putting it.

      Also you dont need the first 2 #'s (they make no difference)

      "#,##0.00" gives the same results as "###,##0.00"

      Could you give a little more detail as to what you are doing with 'MyVar'

      George

      #1; Thu, 05 Jun 2008 09:22:00 GMT
    • On Mon, 13 Feb 2006 16:47:02 -0000, "Always Learning" <NoMoreSpam.excel.todaysummary.com.MyEmail>

      wrote:

      >Hi Guys,

      >Can someone tell me why?

      >If I set a variable Like so:

      > MyVar = Format(TotalCost, "###,##0.00")

      >If the value is 5,241.60 it displays as 5,241.60 but if its 10,483.20 it

      >displays as 10,483.2 missing the final 0 (zero)

      >As always, your help is appreciated.

      >Best Regards,

      >Steve.

      >

      I can see some reasons for this, but:

      How are you displaying MyVar?

      What Type of variable is MyVar and TotalCost?

      --ron

      #2; Thu, 05 Jun 2008 09:23:00 GMT
    • Hi Guys,

      Thanks for the reply's.

      This is the actual bit of code:

      ResultsForm.SRWValueCalculated = Format(TotalCost, "###,##0.00")

      SRWValueCalculated is a label control on a form.

      Thanks for your help.

      Best Regards,

      Steve.

      "Always Learning" <NoMoreSpam.excel.todaysummary.com.MyEmail> wrote in message

      news:%23LUZg0LMGHA.3856.excel.todaysummary.com.TK2MSFTNGP12.phx.gbl...

      > Hi Guys,

      > Can someone tell me why?

      > If I set a variable Like so:

      > MyVar = Format(TotalCost, "###,##0.00")

      > If the value is 5,241.60 it displays as 5,241.60 but if its 10,483.20 it

      > displays as 10,483.2 missing the final 0 (zero)

      > As always, your help is appreciated.

      > Best Regards,

      > Steve.

      >

      #3; Thu, 05 Jun 2008 09:24:00 GMT
    • Sorry,

      Forgot to mention

      Dim TotalCost As Currency

      Thanks.

      "Always Learning" <NoMoreSpam.excel.todaysummary.com.MyEmail> wrote in message

      news:%23LUZg0LMGHA.3856.excel.todaysummary.com.TK2MSFTNGP12.phx.gbl...

      > Hi Guys,

      > Can someone tell me why?

      > If I set a variable Like so:

      > MyVar = Format(TotalCost, "###,##0.00")

      > If the value is 5,241.60 it displays as 5,241.60 but if its 10,483.20 it

      > displays as 10,483.2 missing the final 0 (zero)

      > As always, your help is appreciated.

      > Best Regards,

      > Steve.

      >

      #4; Thu, 05 Jun 2008 09:25:00 GMT
    • On Tue, 14 Feb 2006 09:32:17 -0000, "Always Learning" <NoMoreSpam.excel.todaysummary.com.MyEmail>

      wrote:

      >Sorry,

      >Forgot to mention

      > Dim TotalCost As Currency

      >Thanks.

      >"Always Learning" <NoMoreSpam.excel.todaysummary.com.MyEmail> wrote in message

      >news:%23LUZg0LMGHA.3856.excel.todaysummary.com.TK2MSFTNGP12.phx.gbl...

      >

      I, for one, will need more information before I can help.

      --ron

      #5; Thu, 05 Jun 2008 09:26:00 GMT