Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions counting up number with this expression but using COMMAS

  • counting up number with this expression but using COMMAS

    Posted by Robert Paynter on November 8, 2006 at 8:36 am

    is there anymay to get the commas to show up when using this expression on a text layer to count up?

    startCount = 0;
    endCount = 500000;
    countDur = 200;
    Math.round(linear(time,0,countDur,startCount,endCount))

    Michael Heid replied 6 years, 1 month ago 8 Members · 10 Replies
  • 10 Replies
  • Mylenium

    November 8, 2006 at 12:27 pm

    Treat each group of numbers separately or separate their substrings. I think Dan, Filip or yikesmikes expalined it (again) not so long ago and provided the code, so do a search.

    Mylenium

    [Pour Myl

  • Mylenium

    November 8, 2006 at 12:32 pm
  • Dan Ebberts

    November 8, 2006 at 3:02 pm

    This should do it as long as you don’t go above 999,999:

    startCount = 0;
    endCount = 500000;
    countDur = 200;
    s = “” + Math.round(linear(time,0,countDur,startCount,endCount));

    if (s.length > 3){
    s.substr(0, s.length -3) + “,” + s.substr(-3);
    }else{
    s
    }

    Dan

  • Jefferson Ballew

    May 14, 2015 at 4:43 pm

    Alright all you scripting geniuses, is there any way to add a millions place comma as well, for those times when you have to go over a million? I tried to figure it out, but couldn’t seem to make it work.

  • Dan Ebberts

    May 14, 2015 at 5:21 pm

    I hope this pastes in correctly (it has a few backslashes in it which seem to cause problems some times):


    startCount = 0;
    endCount = 500000;
    countDur = 200;
    s = "" + Math.round(linear(time,0,countDur,startCount,endCount));
    s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");

    Dan

  • Jefferson Ballew

    July 27, 2015 at 11:33 pm

    Sweet! you rock!

  • Liran Tabib

    April 22, 2016 at 7:09 am

    Counter Preset has commas as default, and you can change them to any other character if you want: https://www.vdodna.com/products/counter-preset/
    I hope you will find it Useful

  • Nick Khoo

    January 19, 2017 at 10:15 pm

    Hey I realise this post is almost a decade old but I just posted a video solution that can give you commas up to 999,999,999,999

    https://youtu.be/5WJmrYMifW8

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Alex Bee

    July 5, 2017 at 3:52 pm

    Hello Dan

    Could you please kindly tell me if you can put a “+” sign at the end of a counting up 70,000 with comma?

    Thank you so much.
    Alex

  • Michael Heid

    March 19, 2020 at 1:35 am

    If Dan Ebberts ever decides to stop being helpful, all of the motion graphics community will crumble. Thank you so much sir! I don’t think you can comprehend what your contribution has done for me and after effects users around the world. Thank you, thank you, thank you!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy