XLib


Download
Installation
X-VBA Home

Array
=AverageHigh
=AverageLow
=CountUnique
=IsInArray
=Large
=Reverse
=Small
=Sort
=SumHigh
=SumLow

Color
=Hex2Hsl
=Hex2Rgb
=Hsl2Hex
=Hsl2Rgb
=Rgb2Hex
=Rgb2Hsl
=Rgb2Hsv

DateTime
=DaysOfMonth
=MonthName2
=Quarter
=TimeConverter
=WeekOfMonth
=WeekdayName2

Environment
=ComputerName
=OS
=UserDomain
=UserName

File
=CountFiles
=CountFilesAndFolders
=CountFolders
=CurrentFilePath
=FileCreationTime
=FileDrive
=FileExtension
=FileFolder
=FileLastModifiedTime
=FileName
=FileSize
=FileType
=GetActivePath
=GetActivePathAndName
=GetFileNameByNumber
=PathJoin
=PathSeparator
=ReadFile
=WriteFile

Math
=Ceil
=Floor
=InterpolateNumber
=InterpolatePercent
=Max
=Min
=ModFloat

Meta
=XlibCredits
=XlibDocumentation
=XlibVersion

Network
=Http
=ParseHtmlString
=SimpleHttp

Random
=BigRandBetween
=RandBetween
=RandBetweens
=RandBool
=RandomRange
=RandomSample

Regex
=RegexReplace
=RegexSearch
=RegexTest

StringManipulation
=CamelCase
=Capitalize
=CompanyCase
=CountLowercaseCharacters
=CountUppercaseCharacters
=CountWords
=DedentText
=EliteCase
=Formatter
=InSplit
=IndentText
=KebabCase
=LeftFind
=LeftSearch
=LeftSplit
=RemoveCharacters
=Repeat
=ReverseText
=ReverseWords
=RightFind
=RightSearch
=RightSplit
=ScrambleCase
=ShortenText
=SplitText
=Substr
=SubstrFind
=SubstrSearch
=TextJoin
=TrimChar
=TrimLeft
=TrimRight
=Zfill

StringMetrics
=Damerau
=Hamming
=Levenshtein

Utilities
=BigDec2Hex
=BigHex
=Dec2Hex
=Hex2Dec
=HideText
=HtmlEscape
=HtmlUnescape
=JavaScript
=Jsonify
=Len2
=SpeakText
=UuidFour

Validators
=CreditCardName
=FormatCreditCard
=IsCreditCard
=IsEmail
=IsIPFour
=IsMacAddress
=IsPhone
=IsUrl

DateTime Module

This module contains a set of functions for working with dates and times.


=DaysOfMonth([monthNumberOrName], [yearNumber])

This function takes a month number or month name and returns the number of days in the month. Optionally, a year number can be specified. If no year number is provided, the current year will be used. Finally, note that the month name or number argument is optional and if omitted will use the current month.

Arguments

[(Optional) {Variant}: monthNumberOrName]   ➔   is a number that should be between 1 and 12, with 1 being January and 12 being December, or the name of a Month, such as "January" or "March". If omitted the current month will be used.

[(Optional) {Integer}: yearNumber]   ➔   is the year that will be used. If omitted, the current year will be used.


Returns

{Variant}: Returns the number of days in the month and year specified


Examples

  • =DaysOfMonth() -> 31; Where the current month is January
  • =DaysOfMonth(1) -> 31
  • =DaysOfMonth("January") -> 31
  • =DaysOfMonth(2, 2019) -> 28
  • =DaysOfMonth(2, 2020) -> 29

=MonthName2([monthNumber])

This function takes a month number and returns the name of the month.

Arguments

[(Optional) {Byte}: monthNumber]   ➔   is a number that should be between 1 and 12, with 1 being January and 12 being December. If no monthNumber is given, the value will default to the current month.


Returns

{String}: Returns the month name as a string


Examples

  • =MonthName2(1) -> "January"
  • =MonthName2(3) -> "March"
  • To get today's month name: =MonthName2()

=Quarter([monthNumberOrName])

This function takes a month as a number and returns the Quarter of the year the month resides.

Arguments

[(Optional) {Variant}: monthNumberOrName]   ➔   is a number that should be between 1 and 12, with 1 being January and 12 being December, or the name of a Month, such as "January" or "March".


Returns

{Byte}: Returns the Quarter of the month as a number


Examples

  • =Quarter(4) -> 2
  • =Quarter("April") -> 2
  • =Quarter(12) -> 4
  • =Quarter("December") -> 4
  • To get today's Quarter: =Quarter()

=TimeConverter(date1, [secondsInteger], [minutesInteger], [hoursInteger], [daysInteger], [monthsInteger], [yearsInteger])

This function takes a date, and then a series of optional arguments for a number of seconds, minutes, hours, days, and years, and then converts the date given to a new date adding in the other date argument values.

Arguments

{Date}: date1   ➔   is the original date that will be converted into a new date

[(Optional) {Integer}: secondsInteger]   ➔   is the number of seconds that will be added

[(Optional) {Integer}: minutesInteger]   ➔   is the number of minutes that will be added

[(Optional) {Integer}: hoursInteger]   ➔   is the number of hours that will be added

[(Optional) {Integer}: daysInteger]   ➔   is the number of days that will be added

[(Optional) {Integer}: monthsInteger]   ➔   is the number of months that will be added

[(Optional) {Integer}: yearsInteger]   ➔   is the number of years that will be added


Returns

{Date}: Returns a new date with all the date arguments added to it


Note
You can skip earlier date arguments in the function by putting a 0 in place. For example, if we only wanted to change the month, which is the 5th argument, we can do =TimeConverter(A1,0,0,0,2) which will add 2 months to the date chosen

Examples

  • =TimeConverter(A1,60) -> 1/1/2000 1:01; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,0,5) -> 1/1/2000 1:05; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,0,0,2) -> 1/1/2000 3:00; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,0,0,0,4) -> 1/5/2000 1:00; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,0,0,0,0,1) -> 2/1/2000 1:00; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,0,0,0,0,0,5) -> 1/1/2005 1:00; Where A1 contains the date 1/1/2000 1:00
  • =TimeConverter(A1,60,5,3,10,5,15) -> 6/11/2015 4:06; Where A1 contains the date 1/1/2000 1:00

=WeekOfMonth([date1])

This function takes a date and returns the number of the week of the month for that date. If no date is given, the current date is used.

Arguments

[(Optional) {Date}: date1]   ➔   is a date whose week number will be found


Returns

{Byte}: Returns the number of week in the month


Examples

  • =WeekOfMonth() -> 5; Where the current date is 1/29/2020
  • =WeekOfMonth(1/29/2020) -> 5
  • =WeekOfMonth(1/28/2020) -> 5
  • =WeekOfMonth(1/27/2020) -> 5
  • =WeekOfMonth(1/26/2020) -> 5
  • =WeekOfMonth(1/25/2020) -> 4
  • =WeekOfMonth(1/24/2020) -> 4
  • =WeekOfMonth(1/1/2020) -> 1

=WeekdayName2([dayNumber])

This function takes a weekday number and returns the name of the day of the week.

Arguments

[(Optional) {Byte}: dayNumber]   ➔   is a number that should be between 1 and 7, with 1 being Sunday and 7 being Saturday. If no dayNumber is given, the value will default to the current day of the week.


Returns

{String}: Returns the day of the week as a string


Examples

  • =WeekdayName2(4) -> Wednesday
  • To get today's weekday name: =WeekdayName2()