By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 190 - format


Is a function to make data more readable via the format function

Applies to numbers and dates
  • #,
  • 0
  • mm/dd/yy
  • ddd - day of week

    Immediate Window

    ? format(#3/21/21#,"ddd")
    Sun

    ? format(012313,"#,
  • #0")
    12,313

    ? format(012313,"000000")
    012313

    ? format(12313,"000000")
    012313

    ? format("3/21/21","mm/dd/yyyy")
    03/21/2021

    ? format(now(),"yyyy-mm-dd")
    2021-04-06

    ?formate(now(),"hh:mm")

    ?format(now(),"hh:mm")
    14:06

    ?format(now(),"hh:mm:ss am/pm")
    02:06:37 pm





  •    Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit