Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3990716
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:31:43+00:00 2026-05-20T06:31:43+00:00

In VBScript I’m looking for a function that will return the numbers in the

  • 0

In VBScript I’m looking for a function that will return the numbers in the format 1000s or if 1000,000 or greater in millions as follows:

x = 100,000 then return 100k
y = 500,000 then return 500k
z = 5,000,000 then return 5m
q = 25,000,000 then return 25m 

Where x, y, z, q are integers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:31:43+00:00Added an answer on May 20, 2026 at 6:31 am

    @van: Working example —

    Option Explicit
    
    Function NumFormat(ByRef iNumber, ByRef blnFixed)
        Dim sNumber
    
        If iNumber >= 1000000 Then
            If NOT blnFixed Then
                sNumber = (iNumber / 1000000) & "m"
            Else
                sNumber = Fix(iNumber / 1000000) & "m"
            End If
        ElseIf iNumber >= 100000 Then
            If NOT blnFixed Then
                sNumber = (iNumber / 1000) & "k"
            Else
                sNumber = Fix(iNumber / 1000) & "k"
            End If
        ElseIf iNumber >= 10000 Then
            If NOT blnFixed Then
                sNumber = (iNumber / 1000) & "k"
            Else
                sNumber = Fix(iNumber / 1000) & "k"
            End If
        ElseIf iNumber >= 1000 Then
            If NOT blnFixed Then
                sNumber = (iNumber / 1000) & "k"
            Else
                sNumber = Fix(iNumber / 1000) & "k"
            End If
        End If
    
        NumFormat = sNumber
    End Function
    
    Response.Write NumFormat(56120000, True) & "<br>"
    Response.Write NumFormat(25050000, False) & "<br>"
    Response.Write NumFormat(255000, False) & "<br>"
    Response.Write NumFormat(9009, True) & "<br>"
    Response.Write NumFormat(3000, False) & "<br>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to VBScript. I am trying to write a function that will
VBScript on ASP Classic contains an int function. (It rounds numbers towards -∞.) Suppose
I have a vbscript file that will open a document with the correct program
I have a vbscript file A that will call another vbscript file B. File
Since VBScript doesn't support lookbehinds, I'm looking for an alternative solution. I have the
I have a vbscript that creates a registry entry on a Windows Server 2003
how can i write vbscript that calculates the free space in C: drive of
I've just discovered VBScript's GetRef function, which gets a reference to the function named
in VBScript, I've got a function like: Function InsertPerson(FirstName, LastName, Street1, Street2, City, State,
In VBScript I have code: someLongValue = CLng(DateSerial(2011, 11, 1)) and in that case

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.