npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xl-formula

v1.0.3

Published

Excel like Formulas and syntax for Javascript

Readme

xl-formula

Excel like Formulas and syntax for Javascript

Objective

The main objective of this Library is to provide most used functions in Excel with similar syntax.

Notable Functions:

The most used math functions like SUMIF, SUMIFS, COUNTIF, COUNTIFS and the Date functions DAYS, NETWORKDAYS, WORKDAY, EOMONTH

List of All Functions:

Date's | Time's | Spl Day Funcs | Business Days|Sum's | Count's | Math ----- | ----- | ----- | -----|----- | ----- | ----- | ----- DATE | TIME | DAYS | WORKDAY| SUM | COUNT | PI DAY | HOUR | EOMONTH | WORKDAYINTL| SUMIF | COUNTIF| MONTH | MINUTE | WEEKDAY | NETWORKDAYS| SUMIFS | COUNTIFS| YEAR | SECOND | WEEKNUM | NETWORKDAYSINTL||| | NOW | | |||

Install

npm install xl-formula

Usage

let xl = require('xl-formula')

Example: let someday = xl.DAY("2020-12-31"); output: 31

Important Notes:

  • Syntax is mostly identical to Excel formulas
  • Dates can be in the format of YYYY-MM-DD or MM-DD-YYYY or javascript date notation or Javascript Date Object
  • For Math functions each Column in excel can be considered an Array
  • All the functions are in UPPER CASE

Available Functions

Date Functions

DATE

Returns the serial number of a particular date

Syntax

DATE(year, month, day)

Example

DATE(2020,0,1)
Output: "1/1/2020"

DAY

Converts a serial number to a day of the month

Syntax

DAY(give_Date)

Example

DAY("2020-12-31")
Output: 31

DAYS

Returns the number of days between two dates

Syntax

DAYS(startDate, endDate)

Example

DAYS("2020-01-01", "2020-12-31")
Output: 366

EOMONTH

Returns the serial number of the last day of the month before or after a specified number of months

Syntax

EOMONTH(startDate, months)

Example

EOMONTH("2020-03-03",1)
Output: "4/30/2020"

HOUR

Converts a serial number to an hour

Syntax

HOUR(date_time)

Example

HOUR('March 13, 08 04:20')
Output: 4

MINUTE

Converts a serial number to a minute

Syntax

MINUTE(date_time)

Example

MINUTE('March 13, 08 04:20')
Output: 20

MONTH

Converts a serial number to a month

Syntax

MONTH(give_Date)

Example

MONTH("2020-12-31")
Output: 11

NETWORKDAYS

Returns the number of whole workdays between two dates

Syntax

NETWORKDAYS(startDate, endDate, holidays = [])

Example

NETWORKDAYS("2020-04-21", "2020-04-25", ["2020-04-21", "2020-04-22", "2020-04-24"])
Output: 1

NETWORKDAYSINTL

Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days

Syntax

NETWORKDAYSINTL(startDate, endDate, holidays = [])

Example

NETWORKDAYSINTL("2020-04-21", "2020-04-25", 12, ["2020-04-21", "2020-04-22", "2020-04-24"])
Output: 2

NOW

Returns the serial number of the current date and time

Syntax

NOW()

Example

NOW()
Output: Current Time

SECOND

Converts a serial number to a second

Syntax

SECOND(date_time)

Example

SECOND('March 13, 08 04:20:20')
Output: 20

TIME

Returns the serial number of a particular time

Syntax

TIME(hour, minute, second = 0, _type = 'string' || 'number')

Example

TIME(13, 2, 3)
Output: "02:02:03 PM"

WEEKDAY

Converts a serial number to a day of the week

Syntax

WEEKDAY(give_Date)

Example

WEEKDAY("2020-12-31")
Output: 4

WEEKNUM

Converts a serial number to a number representing where the week falls numerically with a year

Syntax

WEEKNUM(give_Date)

Example

WEEKNUM("2020-12-31")
Output: 53

WORKDAY

Returns the serial number of the date before or after a specified number of workdays

Syntax

WORKDAY(startDate, no_Of_Days, holidays = [])

Example

WORKDAY("2020-04-21", 10, [new Date(2020, 3, 22), new Date(2020, 3, 21)])
Output: "5/1/2020"

WORKDAYINTL

Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days

Syntax

WORKDAYINTL(startDate, no_Of_Days, holidays = [])

Example

WORKDAYINTL("2020-04-21", 10, 1,[new Date(2020, 3, 22), new Date(2020, 3, 21)])
Output: "5/1/2020"

YEAR

Converts a serial number to a year

Syntax

YEAR(give_Date)

Example

YEAR("2020-12-31")
Output: 2020

Math Functions

SUM

Adds its arguments

Syntax

SUM(sumRangeArray = [])

Example

SUM([1, 2, 3, 4, 5])
Output: 15

SUMIF

Adds the cells specified by a given criteria

Syntax

SUMIF(rangeArray = [], criteria, sumRangeArray = [])

Example

SUMIF(["a", "b", "a", "c", "d", "f", "a", "g"], "a", [1, 2, 3, 4, 4, 4, 5, 6])
Output: 9

SUMIFS

Adds the cells in a range that meet multiple criteria

Syntax

SUMIFS(sumRange = [], criterias = [])

Example

SUMIFS([1, 2, 3, 4, 4, 4, 5, 6], [
[""apple"", ""apple"", ""apple"", ""cheese"", ""apple"", ""orange"", ""apple"", ""grape""], ""=='apple'"",
[1, 2, 3, 3, 3, 4, 5, 6], "">=2"",
[""arun"", ""babu"", ""arun"", ""babu"", ""dheera"", ""adhi"", ""vaidhi"", ""vaidhi""], ""!=='arun'""])
Output: 11

COUNT

Counts how many numbers are in the list of arguments

Syntax

COUNT(countArray = [])

Example

COUNT([1, 2, 3, 4, 4, 4, 5, 6])
Output: 8

COUNTIF

Counts the number of cells within a range that meet the given criteria

Syntax

COUNTIF = (rangeArray = [], criteria)

Example

COUNTIF(["a", "b", "a", "c", "d", "f", "a", "g"], "a")
Output: 3

COUNTIFS

Counts the number of cells within a range that meet multiple criteria

Syntax

COUNTIFS(criterias = [])

Example

COUNTIFS([
[""apple"", ""apple"", ""apple"", ""cheese"", ""apple"", ""orange"", ""apple"", ""grape""], ""=='apple'"",
[1, 2, 3, 3, 3, 4, 5, 6], "">=2"",
[""arun"", ""babu"", ""arun"", ""babu"", ""dheera"", ""adhi"", ""vaidhi"", ""vaidhi""], ""!=='arun'""])
Output: 3

PI

Returns the value of pi

Syntax

PI()

Example

PI()
Output: 3.141592654