@papernote/ui 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/components/DataGrid.d.ts +182 -0
- package/dist/components/DataGrid.d.ts.map +1 -0
- package/dist/components/FormulaAutocomplete.d.ts +29 -0
- package/dist/components/FormulaAutocomplete.d.ts.map +1 -0
- package/dist/components/Select.d.ts +2 -0
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.d.ts +195 -2
- package/dist/index.esm.js +2338 -346
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2343 -344
- package/dist/index.js.map +1 -1
- package/dist/styles.css +51 -0
- package/dist/utils/formulaDefinitions.d.ts +25 -0
- package/dist/utils/formulaDefinitions.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/DataGrid.stories.tsx +356 -0
- package/src/components/DataGrid.tsx +1025 -0
- package/src/components/FormulaAutocomplete.tsx +417 -0
- package/src/components/Select.tsx +121 -7
- package/src/components/index.ts +30 -0
- package/src/utils/formulaDefinitions.ts +1228 -0
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formula definitions for DataGrid intellisense
|
|
3
|
+
* Based on fast-formula-parser supported functions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface FormulaParameter {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
optional?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface FormulaDefinition {
|
|
13
|
+
name: string;
|
|
14
|
+
category: FormulaCategory;
|
|
15
|
+
description: string;
|
|
16
|
+
syntax: string;
|
|
17
|
+
parameters: FormulaParameter[];
|
|
18
|
+
example?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type FormulaCategory =
|
|
22
|
+
| 'Math'
|
|
23
|
+
| 'Statistical'
|
|
24
|
+
| 'Lookup'
|
|
25
|
+
| 'Text'
|
|
26
|
+
| 'Logical'
|
|
27
|
+
| 'Date'
|
|
28
|
+
| 'Information'
|
|
29
|
+
| 'Financial';
|
|
30
|
+
|
|
31
|
+
export const FORMULA_DEFINITIONS: FormulaDefinition[] = [
|
|
32
|
+
// ==================== MATH ====================
|
|
33
|
+
{
|
|
34
|
+
name: 'SUM',
|
|
35
|
+
category: 'Math',
|
|
36
|
+
description: 'Adds all numbers in a range of cells',
|
|
37
|
+
syntax: 'SUM(number1, [number2], ...)',
|
|
38
|
+
parameters: [
|
|
39
|
+
{ name: 'number1', description: 'First number or range to add' },
|
|
40
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
41
|
+
],
|
|
42
|
+
example: '=SUM(A1:A10)',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'AVERAGE',
|
|
46
|
+
category: 'Math',
|
|
47
|
+
description: 'Returns the average of the arguments',
|
|
48
|
+
syntax: 'AVERAGE(number1, [number2], ...)',
|
|
49
|
+
parameters: [
|
|
50
|
+
{ name: 'number1', description: 'First number or range' },
|
|
51
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
52
|
+
],
|
|
53
|
+
example: '=AVERAGE(B1:B20)',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'MIN',
|
|
57
|
+
category: 'Math',
|
|
58
|
+
description: 'Returns the minimum value in a list of arguments',
|
|
59
|
+
syntax: 'MIN(number1, [number2], ...)',
|
|
60
|
+
parameters: [
|
|
61
|
+
{ name: 'number1', description: 'First number or range' },
|
|
62
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
63
|
+
],
|
|
64
|
+
example: '=MIN(A1:A100)',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'MAX',
|
|
68
|
+
category: 'Math',
|
|
69
|
+
description: 'Returns the maximum value in a list of arguments',
|
|
70
|
+
syntax: 'MAX(number1, [number2], ...)',
|
|
71
|
+
parameters: [
|
|
72
|
+
{ name: 'number1', description: 'First number or range' },
|
|
73
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
74
|
+
],
|
|
75
|
+
example: '=MAX(A1:A100)',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'COUNT',
|
|
79
|
+
category: 'Math',
|
|
80
|
+
description: 'Counts the number of cells that contain numbers',
|
|
81
|
+
syntax: 'COUNT(value1, [value2], ...)',
|
|
82
|
+
parameters: [
|
|
83
|
+
{ name: 'value1', description: 'First value or range' },
|
|
84
|
+
{ name: 'value2', description: 'Additional values or ranges', optional: true },
|
|
85
|
+
],
|
|
86
|
+
example: '=COUNT(A1:A50)',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'COUNTA',
|
|
90
|
+
category: 'Math',
|
|
91
|
+
description: 'Counts the number of non-empty cells',
|
|
92
|
+
syntax: 'COUNTA(value1, [value2], ...)',
|
|
93
|
+
parameters: [
|
|
94
|
+
{ name: 'value1', description: 'First value or range' },
|
|
95
|
+
{ name: 'value2', description: 'Additional values or ranges', optional: true },
|
|
96
|
+
],
|
|
97
|
+
example: '=COUNTA(A1:A50)',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'ROUND',
|
|
101
|
+
category: 'Math',
|
|
102
|
+
description: 'Rounds a number to a specified number of digits',
|
|
103
|
+
syntax: 'ROUND(number, num_digits)',
|
|
104
|
+
parameters: [
|
|
105
|
+
{ name: 'number', description: 'The number to round' },
|
|
106
|
+
{ name: 'num_digits', description: 'Number of decimal places' },
|
|
107
|
+
],
|
|
108
|
+
example: '=ROUND(3.14159, 2)',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'ROUNDUP',
|
|
112
|
+
category: 'Math',
|
|
113
|
+
description: 'Rounds a number up, away from zero',
|
|
114
|
+
syntax: 'ROUNDUP(number, num_digits)',
|
|
115
|
+
parameters: [
|
|
116
|
+
{ name: 'number', description: 'The number to round up' },
|
|
117
|
+
{ name: 'num_digits', description: 'Number of decimal places' },
|
|
118
|
+
],
|
|
119
|
+
example: '=ROUNDUP(3.14159, 2)',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'ROUNDDOWN',
|
|
123
|
+
category: 'Math',
|
|
124
|
+
description: 'Rounds a number down, toward zero',
|
|
125
|
+
syntax: 'ROUNDDOWN(number, num_digits)',
|
|
126
|
+
parameters: [
|
|
127
|
+
{ name: 'number', description: 'The number to round down' },
|
|
128
|
+
{ name: 'num_digits', description: 'Number of decimal places' },
|
|
129
|
+
],
|
|
130
|
+
example: '=ROUNDDOWN(3.14159, 2)',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'ABS',
|
|
134
|
+
category: 'Math',
|
|
135
|
+
description: 'Returns the absolute value of a number',
|
|
136
|
+
syntax: 'ABS(number)',
|
|
137
|
+
parameters: [{ name: 'number', description: 'The number to get absolute value of' }],
|
|
138
|
+
example: '=ABS(-5)',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'SQRT',
|
|
142
|
+
category: 'Math',
|
|
143
|
+
description: 'Returns the square root of a number',
|
|
144
|
+
syntax: 'SQRT(number)',
|
|
145
|
+
parameters: [{ name: 'number', description: 'The number to get square root of' }],
|
|
146
|
+
example: '=SQRT(16)',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'POWER',
|
|
150
|
+
category: 'Math',
|
|
151
|
+
description: 'Returns the result of a number raised to a power',
|
|
152
|
+
syntax: 'POWER(number, power)',
|
|
153
|
+
parameters: [
|
|
154
|
+
{ name: 'number', description: 'The base number' },
|
|
155
|
+
{ name: 'power', description: 'The exponent' },
|
|
156
|
+
],
|
|
157
|
+
example: '=POWER(2, 8)',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'MOD',
|
|
161
|
+
category: 'Math',
|
|
162
|
+
description: 'Returns the remainder after division',
|
|
163
|
+
syntax: 'MOD(number, divisor)',
|
|
164
|
+
parameters: [
|
|
165
|
+
{ name: 'number', description: 'The number to divide' },
|
|
166
|
+
{ name: 'divisor', description: 'The number to divide by' },
|
|
167
|
+
],
|
|
168
|
+
example: '=MOD(10, 3)',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'INT',
|
|
172
|
+
category: 'Math',
|
|
173
|
+
description: 'Rounds a number down to the nearest integer',
|
|
174
|
+
syntax: 'INT(number)',
|
|
175
|
+
parameters: [{ name: 'number', description: 'The number to round down' }],
|
|
176
|
+
example: '=INT(3.7)',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'CEILING',
|
|
180
|
+
category: 'Math',
|
|
181
|
+
description: 'Rounds a number up to the nearest multiple of significance',
|
|
182
|
+
syntax: 'CEILING(number, significance)',
|
|
183
|
+
parameters: [
|
|
184
|
+
{ name: 'number', description: 'The number to round' },
|
|
185
|
+
{ name: 'significance', description: 'The multiple to round to' },
|
|
186
|
+
],
|
|
187
|
+
example: '=CEILING(4.3, 1)',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'FLOOR',
|
|
191
|
+
category: 'Math',
|
|
192
|
+
description: 'Rounds a number down to the nearest multiple of significance',
|
|
193
|
+
syntax: 'FLOOR(number, significance)',
|
|
194
|
+
parameters: [
|
|
195
|
+
{ name: 'number', description: 'The number to round' },
|
|
196
|
+
{ name: 'significance', description: 'The multiple to round to' },
|
|
197
|
+
],
|
|
198
|
+
example: '=FLOOR(4.7, 1)',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'PRODUCT',
|
|
202
|
+
category: 'Math',
|
|
203
|
+
description: 'Multiplies all the numbers given as arguments',
|
|
204
|
+
syntax: 'PRODUCT(number1, [number2], ...)',
|
|
205
|
+
parameters: [
|
|
206
|
+
{ name: 'number1', description: 'First number or range' },
|
|
207
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
208
|
+
],
|
|
209
|
+
example: '=PRODUCT(A1:A5)',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'SUMPRODUCT',
|
|
213
|
+
category: 'Math',
|
|
214
|
+
description: 'Returns the sum of the products of corresponding array components',
|
|
215
|
+
syntax: 'SUMPRODUCT(array1, [array2], ...)',
|
|
216
|
+
parameters: [
|
|
217
|
+
{ name: 'array1', description: 'First array' },
|
|
218
|
+
{ name: 'array2', description: 'Additional arrays', optional: true },
|
|
219
|
+
],
|
|
220
|
+
example: '=SUMPRODUCT(A1:A5, B1:B5)',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'RAND',
|
|
224
|
+
category: 'Math',
|
|
225
|
+
description: 'Returns a random number between 0 and 1',
|
|
226
|
+
syntax: 'RAND()',
|
|
227
|
+
parameters: [],
|
|
228
|
+
example: '=RAND()',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'RANDBETWEEN',
|
|
232
|
+
category: 'Math',
|
|
233
|
+
description: 'Returns a random integer between the specified values',
|
|
234
|
+
syntax: 'RANDBETWEEN(bottom, top)',
|
|
235
|
+
parameters: [
|
|
236
|
+
{ name: 'bottom', description: 'Minimum value' },
|
|
237
|
+
{ name: 'top', description: 'Maximum value' },
|
|
238
|
+
],
|
|
239
|
+
example: '=RANDBETWEEN(1, 100)',
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
// ==================== STATISTICAL ====================
|
|
243
|
+
{
|
|
244
|
+
name: 'COUNTIF',
|
|
245
|
+
category: 'Statistical',
|
|
246
|
+
description: 'Counts cells that meet a single criterion',
|
|
247
|
+
syntax: 'COUNTIF(range, criteria)',
|
|
248
|
+
parameters: [
|
|
249
|
+
{ name: 'range', description: 'Range of cells to count' },
|
|
250
|
+
{ name: 'criteria', description: 'Condition to match' },
|
|
251
|
+
],
|
|
252
|
+
example: '=COUNTIF(A1:A10, ">5")',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'COUNTIFS',
|
|
256
|
+
category: 'Statistical',
|
|
257
|
+
description: 'Counts cells that meet multiple criteria',
|
|
258
|
+
syntax: 'COUNTIFS(range1, criteria1, [range2], [criteria2], ...)',
|
|
259
|
+
parameters: [
|
|
260
|
+
{ name: 'range1', description: 'First range to evaluate' },
|
|
261
|
+
{ name: 'criteria1', description: 'First condition' },
|
|
262
|
+
{ name: 'range2', description: 'Additional range', optional: true },
|
|
263
|
+
{ name: 'criteria2', description: 'Additional condition', optional: true },
|
|
264
|
+
],
|
|
265
|
+
example: '=COUNTIFS(A:A, ">5", B:B, "<10")',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'SUMIF',
|
|
269
|
+
category: 'Statistical',
|
|
270
|
+
description: 'Sums cells that meet a single criterion',
|
|
271
|
+
syntax: 'SUMIF(range, criteria, [sum_range])',
|
|
272
|
+
parameters: [
|
|
273
|
+
{ name: 'range', description: 'Range to evaluate' },
|
|
274
|
+
{ name: 'criteria', description: 'Condition to match' },
|
|
275
|
+
{ name: 'sum_range', description: 'Actual cells to sum', optional: true },
|
|
276
|
+
],
|
|
277
|
+
example: '=SUMIF(A1:A10, ">5", B1:B10)',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'SUMIFS',
|
|
281
|
+
category: 'Statistical',
|
|
282
|
+
description: 'Sums cells that meet multiple criteria',
|
|
283
|
+
syntax: 'SUMIFS(sum_range, range1, criteria1, [range2], [criteria2], ...)',
|
|
284
|
+
parameters: [
|
|
285
|
+
{ name: 'sum_range', description: 'Cells to sum' },
|
|
286
|
+
{ name: 'range1', description: 'First range to evaluate' },
|
|
287
|
+
{ name: 'criteria1', description: 'First condition' },
|
|
288
|
+
{ name: 'range2', description: 'Additional range', optional: true },
|
|
289
|
+
{ name: 'criteria2', description: 'Additional condition', optional: true },
|
|
290
|
+
],
|
|
291
|
+
example: '=SUMIFS(C:C, A:A, ">5", B:B, "<10")',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'AVERAGEIF',
|
|
295
|
+
category: 'Statistical',
|
|
296
|
+
description: 'Averages cells that meet a single criterion',
|
|
297
|
+
syntax: 'AVERAGEIF(range, criteria, [average_range])',
|
|
298
|
+
parameters: [
|
|
299
|
+
{ name: 'range', description: 'Range to evaluate' },
|
|
300
|
+
{ name: 'criteria', description: 'Condition to match' },
|
|
301
|
+
{ name: 'average_range', description: 'Actual cells to average', optional: true },
|
|
302
|
+
],
|
|
303
|
+
example: '=AVERAGEIF(A1:A10, ">5", B1:B10)',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: 'MEDIAN',
|
|
307
|
+
category: 'Statistical',
|
|
308
|
+
description: 'Returns the median of the given numbers',
|
|
309
|
+
syntax: 'MEDIAN(number1, [number2], ...)',
|
|
310
|
+
parameters: [
|
|
311
|
+
{ name: 'number1', description: 'First number or range' },
|
|
312
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
313
|
+
],
|
|
314
|
+
example: '=MEDIAN(A1:A100)',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: 'MODE',
|
|
318
|
+
category: 'Statistical',
|
|
319
|
+
description: 'Returns the most frequently occurring value',
|
|
320
|
+
syntax: 'MODE(number1, [number2], ...)',
|
|
321
|
+
parameters: [
|
|
322
|
+
{ name: 'number1', description: 'First number or range' },
|
|
323
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
324
|
+
],
|
|
325
|
+
example: '=MODE(A1:A100)',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'STDEV',
|
|
329
|
+
category: 'Statistical',
|
|
330
|
+
description: 'Estimates standard deviation based on a sample',
|
|
331
|
+
syntax: 'STDEV(number1, [number2], ...)',
|
|
332
|
+
parameters: [
|
|
333
|
+
{ name: 'number1', description: 'First number or range' },
|
|
334
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
335
|
+
],
|
|
336
|
+
example: '=STDEV(A1:A100)',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'VAR',
|
|
340
|
+
category: 'Statistical',
|
|
341
|
+
description: 'Estimates variance based on a sample',
|
|
342
|
+
syntax: 'VAR(number1, [number2], ...)',
|
|
343
|
+
parameters: [
|
|
344
|
+
{ name: 'number1', description: 'First number or range' },
|
|
345
|
+
{ name: 'number2', description: 'Additional numbers or ranges', optional: true },
|
|
346
|
+
],
|
|
347
|
+
example: '=VAR(A1:A100)',
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'LARGE',
|
|
351
|
+
category: 'Statistical',
|
|
352
|
+
description: 'Returns the k-th largest value in a data set',
|
|
353
|
+
syntax: 'LARGE(array, k)',
|
|
354
|
+
parameters: [
|
|
355
|
+
{ name: 'array', description: 'Range to search' },
|
|
356
|
+
{ name: 'k', description: 'Position from largest' },
|
|
357
|
+
],
|
|
358
|
+
example: '=LARGE(A1:A100, 3)',
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: 'SMALL',
|
|
362
|
+
category: 'Statistical',
|
|
363
|
+
description: 'Returns the k-th smallest value in a data set',
|
|
364
|
+
syntax: 'SMALL(array, k)',
|
|
365
|
+
parameters: [
|
|
366
|
+
{ name: 'array', description: 'Range to search' },
|
|
367
|
+
{ name: 'k', description: 'Position from smallest' },
|
|
368
|
+
],
|
|
369
|
+
example: '=SMALL(A1:A100, 3)',
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: 'RANK',
|
|
373
|
+
category: 'Statistical',
|
|
374
|
+
description: 'Returns the rank of a number in a list',
|
|
375
|
+
syntax: 'RANK(number, ref, [order])',
|
|
376
|
+
parameters: [
|
|
377
|
+
{ name: 'number', description: 'The number to rank' },
|
|
378
|
+
{ name: 'ref', description: 'Range of numbers' },
|
|
379
|
+
{ name: 'order', description: '0 for descending, non-zero for ascending', optional: true },
|
|
380
|
+
],
|
|
381
|
+
example: '=RANK(A1, A1:A100)',
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: 'PERCENTILE',
|
|
385
|
+
category: 'Statistical',
|
|
386
|
+
description: 'Returns the k-th percentile of values',
|
|
387
|
+
syntax: 'PERCENTILE(array, k)',
|
|
388
|
+
parameters: [
|
|
389
|
+
{ name: 'array', description: 'Range of data' },
|
|
390
|
+
{ name: 'k', description: 'Percentile value (0 to 1)' },
|
|
391
|
+
],
|
|
392
|
+
example: '=PERCENTILE(A1:A100, 0.9)',
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
// ==================== LOOKUP ====================
|
|
396
|
+
{
|
|
397
|
+
name: 'VLOOKUP',
|
|
398
|
+
category: 'Lookup',
|
|
399
|
+
description: 'Looks for a value in the leftmost column and returns a value in the same row from a specified column',
|
|
400
|
+
syntax: 'VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])',
|
|
401
|
+
parameters: [
|
|
402
|
+
{ name: 'lookup_value', description: 'Value to search for' },
|
|
403
|
+
{ name: 'table_array', description: 'Table range to search' },
|
|
404
|
+
{ name: 'col_index_num', description: 'Column number to return (1-based)' },
|
|
405
|
+
{ name: 'range_lookup', description: 'FALSE for exact match, TRUE for approximate', optional: true },
|
|
406
|
+
],
|
|
407
|
+
example: '=VLOOKUP(A1, B1:D10, 2, FALSE)',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'HLOOKUP',
|
|
411
|
+
category: 'Lookup',
|
|
412
|
+
description: 'Looks for a value in the top row and returns a value in the same column from a specified row',
|
|
413
|
+
syntax: 'HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])',
|
|
414
|
+
parameters: [
|
|
415
|
+
{ name: 'lookup_value', description: 'Value to search for' },
|
|
416
|
+
{ name: 'table_array', description: 'Table range to search' },
|
|
417
|
+
{ name: 'row_index_num', description: 'Row number to return (1-based)' },
|
|
418
|
+
{ name: 'range_lookup', description: 'FALSE for exact match, TRUE for approximate', optional: true },
|
|
419
|
+
],
|
|
420
|
+
example: '=HLOOKUP(A1, A1:Z3, 2, FALSE)',
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: 'INDEX',
|
|
424
|
+
category: 'Lookup',
|
|
425
|
+
description: 'Returns a value from a specific position in a range',
|
|
426
|
+
syntax: 'INDEX(array, row_num, [col_num])',
|
|
427
|
+
parameters: [
|
|
428
|
+
{ name: 'array', description: 'Range of cells' },
|
|
429
|
+
{ name: 'row_num', description: 'Row position' },
|
|
430
|
+
{ name: 'col_num', description: 'Column position', optional: true },
|
|
431
|
+
],
|
|
432
|
+
example: '=INDEX(A1:C10, 5, 2)',
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: 'MATCH',
|
|
436
|
+
category: 'Lookup',
|
|
437
|
+
description: 'Returns the relative position of an item in a range',
|
|
438
|
+
syntax: 'MATCH(lookup_value, lookup_array, [match_type])',
|
|
439
|
+
parameters: [
|
|
440
|
+
{ name: 'lookup_value', description: 'Value to find' },
|
|
441
|
+
{ name: 'lookup_array', description: 'Range to search' },
|
|
442
|
+
{ name: 'match_type', description: '0 for exact, 1 for less than, -1 for greater than', optional: true },
|
|
443
|
+
],
|
|
444
|
+
example: '=MATCH("Apple", A1:A10, 0)',
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: 'LOOKUP',
|
|
448
|
+
category: 'Lookup',
|
|
449
|
+
description: 'Looks up a value in a vector or array',
|
|
450
|
+
syntax: 'LOOKUP(lookup_value, lookup_vector, [result_vector])',
|
|
451
|
+
parameters: [
|
|
452
|
+
{ name: 'lookup_value', description: 'Value to find' },
|
|
453
|
+
{ name: 'lookup_vector', description: 'Range to search' },
|
|
454
|
+
{ name: 'result_vector', description: 'Range to return from', optional: true },
|
|
455
|
+
],
|
|
456
|
+
example: '=LOOKUP(5, A1:A10, B1:B10)',
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'CHOOSE',
|
|
460
|
+
category: 'Lookup',
|
|
461
|
+
description: 'Returns a value from a list based on an index',
|
|
462
|
+
syntax: 'CHOOSE(index_num, value1, [value2], ...)',
|
|
463
|
+
parameters: [
|
|
464
|
+
{ name: 'index_num', description: 'Which value to return (1-based)' },
|
|
465
|
+
{ name: 'value1', description: 'First value' },
|
|
466
|
+
{ name: 'value2', description: 'Additional values', optional: true },
|
|
467
|
+
],
|
|
468
|
+
example: '=CHOOSE(2, "Red", "Blue", "Green")',
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: 'ROW',
|
|
472
|
+
category: 'Lookup',
|
|
473
|
+
description: 'Returns the row number of a reference',
|
|
474
|
+
syntax: 'ROW([reference])',
|
|
475
|
+
parameters: [{ name: 'reference', description: 'Cell reference', optional: true }],
|
|
476
|
+
example: '=ROW(A5)',
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'COLUMN',
|
|
480
|
+
category: 'Lookup',
|
|
481
|
+
description: 'Returns the column number of a reference',
|
|
482
|
+
syntax: 'COLUMN([reference])',
|
|
483
|
+
parameters: [{ name: 'reference', description: 'Cell reference', optional: true }],
|
|
484
|
+
example: '=COLUMN(C1)',
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
name: 'ROWS',
|
|
488
|
+
category: 'Lookup',
|
|
489
|
+
description: 'Returns the number of rows in a reference',
|
|
490
|
+
syntax: 'ROWS(array)',
|
|
491
|
+
parameters: [{ name: 'array', description: 'Range reference' }],
|
|
492
|
+
example: '=ROWS(A1:A10)',
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: 'COLUMNS',
|
|
496
|
+
category: 'Lookup',
|
|
497
|
+
description: 'Returns the number of columns in a reference',
|
|
498
|
+
syntax: 'COLUMNS(array)',
|
|
499
|
+
parameters: [{ name: 'array', description: 'Range reference' }],
|
|
500
|
+
example: '=COLUMNS(A1:D1)',
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: 'OFFSET',
|
|
504
|
+
category: 'Lookup',
|
|
505
|
+
description: 'Returns a reference offset from a starting point',
|
|
506
|
+
syntax: 'OFFSET(reference, rows, cols, [height], [width])',
|
|
507
|
+
parameters: [
|
|
508
|
+
{ name: 'reference', description: 'Starting cell' },
|
|
509
|
+
{ name: 'rows', description: 'Rows to offset' },
|
|
510
|
+
{ name: 'cols', description: 'Columns to offset' },
|
|
511
|
+
{ name: 'height', description: 'Height of result', optional: true },
|
|
512
|
+
{ name: 'width', description: 'Width of result', optional: true },
|
|
513
|
+
],
|
|
514
|
+
example: '=OFFSET(A1, 2, 3)',
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: 'INDIRECT',
|
|
518
|
+
category: 'Lookup',
|
|
519
|
+
description: 'Returns the reference specified by a text string',
|
|
520
|
+
syntax: 'INDIRECT(ref_text, [a1])',
|
|
521
|
+
parameters: [
|
|
522
|
+
{ name: 'ref_text', description: 'Reference as text' },
|
|
523
|
+
{ name: 'a1', description: 'TRUE for A1 style, FALSE for R1C1', optional: true },
|
|
524
|
+
],
|
|
525
|
+
example: '=INDIRECT("A" & B1)',
|
|
526
|
+
},
|
|
527
|
+
|
|
528
|
+
// ==================== TEXT ====================
|
|
529
|
+
{
|
|
530
|
+
name: 'CONCATENATE',
|
|
531
|
+
category: 'Text',
|
|
532
|
+
description: 'Joins several text strings into one',
|
|
533
|
+
syntax: 'CONCATENATE(text1, [text2], ...)',
|
|
534
|
+
parameters: [
|
|
535
|
+
{ name: 'text1', description: 'First text' },
|
|
536
|
+
{ name: 'text2', description: 'Additional text', optional: true },
|
|
537
|
+
],
|
|
538
|
+
example: '=CONCATENATE(A1, " ", B1)',
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
name: 'CONCAT',
|
|
542
|
+
category: 'Text',
|
|
543
|
+
description: 'Joins text from multiple ranges',
|
|
544
|
+
syntax: 'CONCAT(text1, [text2], ...)',
|
|
545
|
+
parameters: [
|
|
546
|
+
{ name: 'text1', description: 'First text or range' },
|
|
547
|
+
{ name: 'text2', description: 'Additional text or ranges', optional: true },
|
|
548
|
+
],
|
|
549
|
+
example: '=CONCAT(A1:A5)',
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: 'LEFT',
|
|
553
|
+
category: 'Text',
|
|
554
|
+
description: 'Returns the leftmost characters from a text string',
|
|
555
|
+
syntax: 'LEFT(text, [num_chars])',
|
|
556
|
+
parameters: [
|
|
557
|
+
{ name: 'text', description: 'Text string' },
|
|
558
|
+
{ name: 'num_chars', description: 'Number of characters', optional: true },
|
|
559
|
+
],
|
|
560
|
+
example: '=LEFT(A1, 5)',
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: 'RIGHT',
|
|
564
|
+
category: 'Text',
|
|
565
|
+
description: 'Returns the rightmost characters from a text string',
|
|
566
|
+
syntax: 'RIGHT(text, [num_chars])',
|
|
567
|
+
parameters: [
|
|
568
|
+
{ name: 'text', description: 'Text string' },
|
|
569
|
+
{ name: 'num_chars', description: 'Number of characters', optional: true },
|
|
570
|
+
],
|
|
571
|
+
example: '=RIGHT(A1, 5)',
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: 'MID',
|
|
575
|
+
category: 'Text',
|
|
576
|
+
description: 'Returns characters from the middle of a text string',
|
|
577
|
+
syntax: 'MID(text, start_num, num_chars)',
|
|
578
|
+
parameters: [
|
|
579
|
+
{ name: 'text', description: 'Text string' },
|
|
580
|
+
{ name: 'start_num', description: 'Starting position' },
|
|
581
|
+
{ name: 'num_chars', description: 'Number of characters' },
|
|
582
|
+
],
|
|
583
|
+
example: '=MID(A1, 3, 5)',
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'LEN',
|
|
587
|
+
category: 'Text',
|
|
588
|
+
description: 'Returns the number of characters in a text string',
|
|
589
|
+
syntax: 'LEN(text)',
|
|
590
|
+
parameters: [{ name: 'text', description: 'Text string' }],
|
|
591
|
+
example: '=LEN(A1)',
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: 'UPPER',
|
|
595
|
+
category: 'Text',
|
|
596
|
+
description: 'Converts text to uppercase',
|
|
597
|
+
syntax: 'UPPER(text)',
|
|
598
|
+
parameters: [{ name: 'text', description: 'Text to convert' }],
|
|
599
|
+
example: '=UPPER(A1)',
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: 'LOWER',
|
|
603
|
+
category: 'Text',
|
|
604
|
+
description: 'Converts text to lowercase',
|
|
605
|
+
syntax: 'LOWER(text)',
|
|
606
|
+
parameters: [{ name: 'text', description: 'Text to convert' }],
|
|
607
|
+
example: '=LOWER(A1)',
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'PROPER',
|
|
611
|
+
category: 'Text',
|
|
612
|
+
description: 'Capitalizes the first letter of each word',
|
|
613
|
+
syntax: 'PROPER(text)',
|
|
614
|
+
parameters: [{ name: 'text', description: 'Text to convert' }],
|
|
615
|
+
example: '=PROPER(A1)',
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
name: 'TRIM',
|
|
619
|
+
category: 'Text',
|
|
620
|
+
description: 'Removes extra spaces from text',
|
|
621
|
+
syntax: 'TRIM(text)',
|
|
622
|
+
parameters: [{ name: 'text', description: 'Text to trim' }],
|
|
623
|
+
example: '=TRIM(A1)',
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: 'CLEAN',
|
|
627
|
+
category: 'Text',
|
|
628
|
+
description: 'Removes non-printable characters from text',
|
|
629
|
+
syntax: 'CLEAN(text)',
|
|
630
|
+
parameters: [{ name: 'text', description: 'Text to clean' }],
|
|
631
|
+
example: '=CLEAN(A1)',
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
name: 'FIND',
|
|
635
|
+
category: 'Text',
|
|
636
|
+
description: 'Finds one text string within another (case-sensitive)',
|
|
637
|
+
syntax: 'FIND(find_text, within_text, [start_num])',
|
|
638
|
+
parameters: [
|
|
639
|
+
{ name: 'find_text', description: 'Text to find' },
|
|
640
|
+
{ name: 'within_text', description: 'Text to search in' },
|
|
641
|
+
{ name: 'start_num', description: 'Starting position', optional: true },
|
|
642
|
+
],
|
|
643
|
+
example: '=FIND("@", A1)',
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: 'SEARCH',
|
|
647
|
+
category: 'Text',
|
|
648
|
+
description: 'Finds one text string within another (case-insensitive)',
|
|
649
|
+
syntax: 'SEARCH(find_text, within_text, [start_num])',
|
|
650
|
+
parameters: [
|
|
651
|
+
{ name: 'find_text', description: 'Text to find' },
|
|
652
|
+
{ name: 'within_text', description: 'Text to search in' },
|
|
653
|
+
{ name: 'start_num', description: 'Starting position', optional: true },
|
|
654
|
+
],
|
|
655
|
+
example: '=SEARCH("test", A1)',
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: 'REPLACE',
|
|
659
|
+
category: 'Text',
|
|
660
|
+
description: 'Replaces part of a text string with different text',
|
|
661
|
+
syntax: 'REPLACE(old_text, start_num, num_chars, new_text)',
|
|
662
|
+
parameters: [
|
|
663
|
+
{ name: 'old_text', description: 'Original text' },
|
|
664
|
+
{ name: 'start_num', description: 'Starting position' },
|
|
665
|
+
{ name: 'num_chars', description: 'Number of characters to replace' },
|
|
666
|
+
{ name: 'new_text', description: 'Replacement text' },
|
|
667
|
+
],
|
|
668
|
+
example: '=REPLACE(A1, 1, 3, "New")',
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: 'SUBSTITUTE',
|
|
672
|
+
category: 'Text',
|
|
673
|
+
description: 'Substitutes new text for old text in a string',
|
|
674
|
+
syntax: 'SUBSTITUTE(text, old_text, new_text, [instance_num])',
|
|
675
|
+
parameters: [
|
|
676
|
+
{ name: 'text', description: 'Original text' },
|
|
677
|
+
{ name: 'old_text', description: 'Text to replace' },
|
|
678
|
+
{ name: 'new_text', description: 'Replacement text' },
|
|
679
|
+
{ name: 'instance_num', description: 'Which occurrence to replace', optional: true },
|
|
680
|
+
],
|
|
681
|
+
example: '=SUBSTITUTE(A1, "old", "new")',
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'TEXT',
|
|
685
|
+
category: 'Text',
|
|
686
|
+
description: 'Formats a number as text with a specified format',
|
|
687
|
+
syntax: 'TEXT(value, format_text)',
|
|
688
|
+
parameters: [
|
|
689
|
+
{ name: 'value', description: 'Value to format' },
|
|
690
|
+
{ name: 'format_text', description: 'Format code' },
|
|
691
|
+
],
|
|
692
|
+
example: '=TEXT(A1, "$#,##0.00")',
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: 'VALUE',
|
|
696
|
+
category: 'Text',
|
|
697
|
+
description: 'Converts a text string that represents a number to a number',
|
|
698
|
+
syntax: 'VALUE(text)',
|
|
699
|
+
parameters: [{ name: 'text', description: 'Text to convert' }],
|
|
700
|
+
example: '=VALUE("123.45")',
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: 'REPT',
|
|
704
|
+
category: 'Text',
|
|
705
|
+
description: 'Repeats text a specified number of times',
|
|
706
|
+
syntax: 'REPT(text, number_times)',
|
|
707
|
+
parameters: [
|
|
708
|
+
{ name: 'text', description: 'Text to repeat' },
|
|
709
|
+
{ name: 'number_times', description: 'Number of repetitions' },
|
|
710
|
+
],
|
|
711
|
+
example: '=REPT("*", 5)',
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: 'EXACT',
|
|
715
|
+
category: 'Text',
|
|
716
|
+
description: 'Checks if two text strings are exactly the same',
|
|
717
|
+
syntax: 'EXACT(text1, text2)',
|
|
718
|
+
parameters: [
|
|
719
|
+
{ name: 'text1', description: 'First text' },
|
|
720
|
+
{ name: 'text2', description: 'Second text' },
|
|
721
|
+
],
|
|
722
|
+
example: '=EXACT(A1, B1)',
|
|
723
|
+
},
|
|
724
|
+
|
|
725
|
+
// ==================== LOGICAL ====================
|
|
726
|
+
{
|
|
727
|
+
name: 'IF',
|
|
728
|
+
category: 'Logical',
|
|
729
|
+
description: 'Returns one value if a condition is true, another if false',
|
|
730
|
+
syntax: 'IF(logical_test, value_if_true, [value_if_false])',
|
|
731
|
+
parameters: [
|
|
732
|
+
{ name: 'logical_test', description: 'Condition to test' },
|
|
733
|
+
{ name: 'value_if_true', description: 'Value if condition is true' },
|
|
734
|
+
{ name: 'value_if_false', description: 'Value if condition is false', optional: true },
|
|
735
|
+
],
|
|
736
|
+
example: '=IF(A1>10, "High", "Low")',
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
name: 'IFS',
|
|
740
|
+
category: 'Logical',
|
|
741
|
+
description: 'Checks multiple conditions and returns the first TRUE result',
|
|
742
|
+
syntax: 'IFS(condition1, value1, [condition2, value2], ...)',
|
|
743
|
+
parameters: [
|
|
744
|
+
{ name: 'condition1', description: 'First condition' },
|
|
745
|
+
{ name: 'value1', description: 'Value if first condition is true' },
|
|
746
|
+
{ name: 'condition2', description: 'Second condition', optional: true },
|
|
747
|
+
{ name: 'value2', description: 'Value if second condition is true', optional: true },
|
|
748
|
+
],
|
|
749
|
+
example: '=IFS(A1>90, "A", A1>80, "B", A1>70, "C")',
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: 'AND',
|
|
753
|
+
category: 'Logical',
|
|
754
|
+
description: 'Returns TRUE if all arguments are true',
|
|
755
|
+
syntax: 'AND(logical1, [logical2], ...)',
|
|
756
|
+
parameters: [
|
|
757
|
+
{ name: 'logical1', description: 'First condition' },
|
|
758
|
+
{ name: 'logical2', description: 'Additional conditions', optional: true },
|
|
759
|
+
],
|
|
760
|
+
example: '=AND(A1>5, A1<10)',
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: 'OR',
|
|
764
|
+
category: 'Logical',
|
|
765
|
+
description: 'Returns TRUE if any argument is true',
|
|
766
|
+
syntax: 'OR(logical1, [logical2], ...)',
|
|
767
|
+
parameters: [
|
|
768
|
+
{ name: 'logical1', description: 'First condition' },
|
|
769
|
+
{ name: 'logical2', description: 'Additional conditions', optional: true },
|
|
770
|
+
],
|
|
771
|
+
example: '=OR(A1="Yes", A1="Y")',
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: 'NOT',
|
|
775
|
+
category: 'Logical',
|
|
776
|
+
description: 'Reverses the logic of its argument',
|
|
777
|
+
syntax: 'NOT(logical)',
|
|
778
|
+
parameters: [{ name: 'logical', description: 'Value to reverse' }],
|
|
779
|
+
example: '=NOT(A1>10)',
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: 'XOR',
|
|
783
|
+
category: 'Logical',
|
|
784
|
+
description: 'Returns TRUE if an odd number of arguments are true',
|
|
785
|
+
syntax: 'XOR(logical1, [logical2], ...)',
|
|
786
|
+
parameters: [
|
|
787
|
+
{ name: 'logical1', description: 'First condition' },
|
|
788
|
+
{ name: 'logical2', description: 'Additional conditions', optional: true },
|
|
789
|
+
],
|
|
790
|
+
example: '=XOR(A1>5, B1>5)',
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: 'IFERROR',
|
|
794
|
+
category: 'Logical',
|
|
795
|
+
description: 'Returns a value if an expression results in an error',
|
|
796
|
+
syntax: 'IFERROR(value, value_if_error)',
|
|
797
|
+
parameters: [
|
|
798
|
+
{ name: 'value', description: 'Expression to check' },
|
|
799
|
+
{ name: 'value_if_error', description: 'Value to return on error' },
|
|
800
|
+
],
|
|
801
|
+
example: '=IFERROR(A1/B1, 0)',
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: 'IFNA',
|
|
805
|
+
category: 'Logical',
|
|
806
|
+
description: 'Returns a value if an expression results in #N/A',
|
|
807
|
+
syntax: 'IFNA(value, value_if_na)',
|
|
808
|
+
parameters: [
|
|
809
|
+
{ name: 'value', description: 'Expression to check' },
|
|
810
|
+
{ name: 'value_if_na', description: 'Value to return if #N/A' },
|
|
811
|
+
],
|
|
812
|
+
example: '=IFNA(VLOOKUP(A1, B:C, 2, FALSE), "Not found")',
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: 'TRUE',
|
|
816
|
+
category: 'Logical',
|
|
817
|
+
description: 'Returns the logical value TRUE',
|
|
818
|
+
syntax: 'TRUE()',
|
|
819
|
+
parameters: [],
|
|
820
|
+
example: '=TRUE()',
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
name: 'FALSE',
|
|
824
|
+
category: 'Logical',
|
|
825
|
+
description: 'Returns the logical value FALSE',
|
|
826
|
+
syntax: 'FALSE()',
|
|
827
|
+
parameters: [],
|
|
828
|
+
example: '=FALSE()',
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: 'SWITCH',
|
|
832
|
+
category: 'Logical',
|
|
833
|
+
description: 'Evaluates an expression against a list of values',
|
|
834
|
+
syntax: 'SWITCH(expression, value1, result1, [value2, result2], ..., [default])',
|
|
835
|
+
parameters: [
|
|
836
|
+
{ name: 'expression', description: 'Value to compare' },
|
|
837
|
+
{ name: 'value1', description: 'First value to match' },
|
|
838
|
+
{ name: 'result1', description: 'Result if first value matches' },
|
|
839
|
+
{ name: 'default', description: 'Default result if no match', optional: true },
|
|
840
|
+
],
|
|
841
|
+
example: '=SWITCH(A1, 1, "One", 2, "Two", "Other")',
|
|
842
|
+
},
|
|
843
|
+
|
|
844
|
+
// ==================== DATE ====================
|
|
845
|
+
{
|
|
846
|
+
name: 'DATE',
|
|
847
|
+
category: 'Date',
|
|
848
|
+
description: 'Creates a date from year, month, and day',
|
|
849
|
+
syntax: 'DATE(year, month, day)',
|
|
850
|
+
parameters: [
|
|
851
|
+
{ name: 'year', description: 'Year number' },
|
|
852
|
+
{ name: 'month', description: 'Month number (1-12)' },
|
|
853
|
+
{ name: 'day', description: 'Day number' },
|
|
854
|
+
],
|
|
855
|
+
example: '=DATE(2025, 1, 15)',
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
name: 'TODAY',
|
|
859
|
+
category: 'Date',
|
|
860
|
+
description: 'Returns the current date',
|
|
861
|
+
syntax: 'TODAY()',
|
|
862
|
+
parameters: [],
|
|
863
|
+
example: '=TODAY()',
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
name: 'NOW',
|
|
867
|
+
category: 'Date',
|
|
868
|
+
description: 'Returns the current date and time',
|
|
869
|
+
syntax: 'NOW()',
|
|
870
|
+
parameters: [],
|
|
871
|
+
example: '=NOW()',
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
name: 'YEAR',
|
|
875
|
+
category: 'Date',
|
|
876
|
+
description: 'Returns the year of a date',
|
|
877
|
+
syntax: 'YEAR(serial_number)',
|
|
878
|
+
parameters: [{ name: 'serial_number', description: 'Date value' }],
|
|
879
|
+
example: '=YEAR(A1)',
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
name: 'MONTH',
|
|
883
|
+
category: 'Date',
|
|
884
|
+
description: 'Returns the month of a date (1-12)',
|
|
885
|
+
syntax: 'MONTH(serial_number)',
|
|
886
|
+
parameters: [{ name: 'serial_number', description: 'Date value' }],
|
|
887
|
+
example: '=MONTH(A1)',
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
name: 'DAY',
|
|
891
|
+
category: 'Date',
|
|
892
|
+
description: 'Returns the day of a date (1-31)',
|
|
893
|
+
syntax: 'DAY(serial_number)',
|
|
894
|
+
parameters: [{ name: 'serial_number', description: 'Date value' }],
|
|
895
|
+
example: '=DAY(A1)',
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: 'HOUR',
|
|
899
|
+
category: 'Date',
|
|
900
|
+
description: 'Returns the hour of a time (0-23)',
|
|
901
|
+
syntax: 'HOUR(serial_number)',
|
|
902
|
+
parameters: [{ name: 'serial_number', description: 'Time value' }],
|
|
903
|
+
example: '=HOUR(A1)',
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: 'MINUTE',
|
|
907
|
+
category: 'Date',
|
|
908
|
+
description: 'Returns the minute of a time (0-59)',
|
|
909
|
+
syntax: 'MINUTE(serial_number)',
|
|
910
|
+
parameters: [{ name: 'serial_number', description: 'Time value' }],
|
|
911
|
+
example: '=MINUTE(A1)',
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
name: 'SECOND',
|
|
915
|
+
category: 'Date',
|
|
916
|
+
description: 'Returns the second of a time (0-59)',
|
|
917
|
+
syntax: 'SECOND(serial_number)',
|
|
918
|
+
parameters: [{ name: 'serial_number', description: 'Time value' }],
|
|
919
|
+
example: '=SECOND(A1)',
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
name: 'WEEKDAY',
|
|
923
|
+
category: 'Date',
|
|
924
|
+
description: 'Returns the day of the week (1-7)',
|
|
925
|
+
syntax: 'WEEKDAY(serial_number, [return_type])',
|
|
926
|
+
parameters: [
|
|
927
|
+
{ name: 'serial_number', description: 'Date value' },
|
|
928
|
+
{ name: 'return_type', description: 'Number system to use', optional: true },
|
|
929
|
+
],
|
|
930
|
+
example: '=WEEKDAY(A1)',
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: 'WEEKNUM',
|
|
934
|
+
category: 'Date',
|
|
935
|
+
description: 'Returns the week number of the year',
|
|
936
|
+
syntax: 'WEEKNUM(serial_number, [return_type])',
|
|
937
|
+
parameters: [
|
|
938
|
+
{ name: 'serial_number', description: 'Date value' },
|
|
939
|
+
{ name: 'return_type', description: 'Week calculation method', optional: true },
|
|
940
|
+
],
|
|
941
|
+
example: '=WEEKNUM(A1)',
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
name: 'DATEDIF',
|
|
945
|
+
category: 'Date',
|
|
946
|
+
description: 'Calculates the difference between two dates',
|
|
947
|
+
syntax: 'DATEDIF(start_date, end_date, unit)',
|
|
948
|
+
parameters: [
|
|
949
|
+
{ name: 'start_date', description: 'Start date' },
|
|
950
|
+
{ name: 'end_date', description: 'End date' },
|
|
951
|
+
{ name: 'unit', description: '"Y", "M", "D", "YM", "YD", or "MD"' },
|
|
952
|
+
],
|
|
953
|
+
example: '=DATEDIF(A1, B1, "D")',
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
name: 'EDATE',
|
|
957
|
+
category: 'Date',
|
|
958
|
+
description: 'Returns a date a specified number of months before or after',
|
|
959
|
+
syntax: 'EDATE(start_date, months)',
|
|
960
|
+
parameters: [
|
|
961
|
+
{ name: 'start_date', description: 'Starting date' },
|
|
962
|
+
{ name: 'months', description: 'Number of months' },
|
|
963
|
+
],
|
|
964
|
+
example: '=EDATE(A1, 3)',
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
name: 'EOMONTH',
|
|
968
|
+
category: 'Date',
|
|
969
|
+
description: 'Returns the last day of the month, months before or after',
|
|
970
|
+
syntax: 'EOMONTH(start_date, months)',
|
|
971
|
+
parameters: [
|
|
972
|
+
{ name: 'start_date', description: 'Starting date' },
|
|
973
|
+
{ name: 'months', description: 'Number of months' },
|
|
974
|
+
],
|
|
975
|
+
example: '=EOMONTH(A1, 0)',
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: 'NETWORKDAYS',
|
|
979
|
+
category: 'Date',
|
|
980
|
+
description: 'Returns the number of working days between two dates',
|
|
981
|
+
syntax: 'NETWORKDAYS(start_date, end_date, [holidays])',
|
|
982
|
+
parameters: [
|
|
983
|
+
{ name: 'start_date', description: 'Start date' },
|
|
984
|
+
{ name: 'end_date', description: 'End date' },
|
|
985
|
+
{ name: 'holidays', description: 'Range of holiday dates', optional: true },
|
|
986
|
+
],
|
|
987
|
+
example: '=NETWORKDAYS(A1, B1)',
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
name: 'WORKDAY',
|
|
991
|
+
category: 'Date',
|
|
992
|
+
description: 'Returns a date a specified number of workdays before or after',
|
|
993
|
+
syntax: 'WORKDAY(start_date, days, [holidays])',
|
|
994
|
+
parameters: [
|
|
995
|
+
{ name: 'start_date', description: 'Starting date' },
|
|
996
|
+
{ name: 'days', description: 'Number of workdays' },
|
|
997
|
+
{ name: 'holidays', description: 'Range of holiday dates', optional: true },
|
|
998
|
+
],
|
|
999
|
+
example: '=WORKDAY(A1, 10)',
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
name: 'TIME',
|
|
1003
|
+
category: 'Date',
|
|
1004
|
+
description: 'Creates a time from hour, minute, and second',
|
|
1005
|
+
syntax: 'TIME(hour, minute, second)',
|
|
1006
|
+
parameters: [
|
|
1007
|
+
{ name: 'hour', description: 'Hour (0-23)' },
|
|
1008
|
+
{ name: 'minute', description: 'Minute (0-59)' },
|
|
1009
|
+
{ name: 'second', description: 'Second (0-59)' },
|
|
1010
|
+
],
|
|
1011
|
+
example: '=TIME(14, 30, 0)',
|
|
1012
|
+
},
|
|
1013
|
+
|
|
1014
|
+
// ==================== INFORMATION ====================
|
|
1015
|
+
{
|
|
1016
|
+
name: 'ISBLANK',
|
|
1017
|
+
category: 'Information',
|
|
1018
|
+
description: 'Returns TRUE if the cell is empty',
|
|
1019
|
+
syntax: 'ISBLANK(value)',
|
|
1020
|
+
parameters: [{ name: 'value', description: 'Cell to check' }],
|
|
1021
|
+
example: '=ISBLANK(A1)',
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
name: 'ISNUMBER',
|
|
1025
|
+
category: 'Information',
|
|
1026
|
+
description: 'Returns TRUE if the value is a number',
|
|
1027
|
+
syntax: 'ISNUMBER(value)',
|
|
1028
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1029
|
+
example: '=ISNUMBER(A1)',
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: 'ISTEXT',
|
|
1033
|
+
category: 'Information',
|
|
1034
|
+
description: 'Returns TRUE if the value is text',
|
|
1035
|
+
syntax: 'ISTEXT(value)',
|
|
1036
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1037
|
+
example: '=ISTEXT(A1)',
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
name: 'ISERROR',
|
|
1041
|
+
category: 'Information',
|
|
1042
|
+
description: 'Returns TRUE if the value is any error',
|
|
1043
|
+
syntax: 'ISERROR(value)',
|
|
1044
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1045
|
+
example: '=ISERROR(A1)',
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
name: 'ISNA',
|
|
1049
|
+
category: 'Information',
|
|
1050
|
+
description: 'Returns TRUE if the value is #N/A',
|
|
1051
|
+
syntax: 'ISNA(value)',
|
|
1052
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1053
|
+
example: '=ISNA(A1)',
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
name: 'ISLOGICAL',
|
|
1057
|
+
category: 'Information',
|
|
1058
|
+
description: 'Returns TRUE if the value is a logical value',
|
|
1059
|
+
syntax: 'ISLOGICAL(value)',
|
|
1060
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1061
|
+
example: '=ISLOGICAL(A1)',
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
name: 'ISEVEN',
|
|
1065
|
+
category: 'Information',
|
|
1066
|
+
description: 'Returns TRUE if the number is even',
|
|
1067
|
+
syntax: 'ISEVEN(number)',
|
|
1068
|
+
parameters: [{ name: 'number', description: 'Number to check' }],
|
|
1069
|
+
example: '=ISEVEN(A1)',
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
name: 'ISODD',
|
|
1073
|
+
category: 'Information',
|
|
1074
|
+
description: 'Returns TRUE if the number is odd',
|
|
1075
|
+
syntax: 'ISODD(number)',
|
|
1076
|
+
parameters: [{ name: 'number', description: 'Number to check' }],
|
|
1077
|
+
example: '=ISODD(A1)',
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
name: 'TYPE',
|
|
1081
|
+
category: 'Information',
|
|
1082
|
+
description: 'Returns a number indicating the data type',
|
|
1083
|
+
syntax: 'TYPE(value)',
|
|
1084
|
+
parameters: [{ name: 'value', description: 'Value to check' }],
|
|
1085
|
+
example: '=TYPE(A1)',
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
name: 'N',
|
|
1089
|
+
category: 'Information',
|
|
1090
|
+
description: 'Returns a value converted to a number',
|
|
1091
|
+
syntax: 'N(value)',
|
|
1092
|
+
parameters: [{ name: 'value', description: 'Value to convert' }],
|
|
1093
|
+
example: '=N(A1)',
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
name: 'NA',
|
|
1097
|
+
category: 'Information',
|
|
1098
|
+
description: 'Returns the error value #N/A',
|
|
1099
|
+
syntax: 'NA()',
|
|
1100
|
+
parameters: [],
|
|
1101
|
+
example: '=NA()',
|
|
1102
|
+
},
|
|
1103
|
+
|
|
1104
|
+
// ==================== FINANCIAL ====================
|
|
1105
|
+
{
|
|
1106
|
+
name: 'PMT',
|
|
1107
|
+
category: 'Financial',
|
|
1108
|
+
description: 'Calculates the payment for a loan',
|
|
1109
|
+
syntax: 'PMT(rate, nper, pv, [fv], [type])',
|
|
1110
|
+
parameters: [
|
|
1111
|
+
{ name: 'rate', description: 'Interest rate per period' },
|
|
1112
|
+
{ name: 'nper', description: 'Total number of payments' },
|
|
1113
|
+
{ name: 'pv', description: 'Present value (loan amount)' },
|
|
1114
|
+
{ name: 'fv', description: 'Future value', optional: true },
|
|
1115
|
+
{ name: 'type', description: '0 = end of period, 1 = beginning', optional: true },
|
|
1116
|
+
],
|
|
1117
|
+
example: '=PMT(0.05/12, 60, 10000)',
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
name: 'PV',
|
|
1121
|
+
category: 'Financial',
|
|
1122
|
+
description: 'Returns the present value of an investment',
|
|
1123
|
+
syntax: 'PV(rate, nper, pmt, [fv], [type])',
|
|
1124
|
+
parameters: [
|
|
1125
|
+
{ name: 'rate', description: 'Interest rate per period' },
|
|
1126
|
+
{ name: 'nper', description: 'Total number of periods' },
|
|
1127
|
+
{ name: 'pmt', description: 'Payment per period' },
|
|
1128
|
+
{ name: 'fv', description: 'Future value', optional: true },
|
|
1129
|
+
{ name: 'type', description: '0 = end, 1 = beginning', optional: true },
|
|
1130
|
+
],
|
|
1131
|
+
example: '=PV(0.05/12, 60, -100)',
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: 'FV',
|
|
1135
|
+
category: 'Financial',
|
|
1136
|
+
description: 'Returns the future value of an investment',
|
|
1137
|
+
syntax: 'FV(rate, nper, pmt, [pv], [type])',
|
|
1138
|
+
parameters: [
|
|
1139
|
+
{ name: 'rate', description: 'Interest rate per period' },
|
|
1140
|
+
{ name: 'nper', description: 'Total number of periods' },
|
|
1141
|
+
{ name: 'pmt', description: 'Payment per period' },
|
|
1142
|
+
{ name: 'pv', description: 'Present value', optional: true },
|
|
1143
|
+
{ name: 'type', description: '0 = end, 1 = beginning', optional: true },
|
|
1144
|
+
],
|
|
1145
|
+
example: '=FV(0.05/12, 60, -100)',
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: 'NPV',
|
|
1149
|
+
category: 'Financial',
|
|
1150
|
+
description: 'Returns the net present value of an investment',
|
|
1151
|
+
syntax: 'NPV(rate, value1, [value2], ...)',
|
|
1152
|
+
parameters: [
|
|
1153
|
+
{ name: 'rate', description: 'Discount rate' },
|
|
1154
|
+
{ name: 'value1', description: 'First cash flow' },
|
|
1155
|
+
{ name: 'value2', description: 'Additional cash flows', optional: true },
|
|
1156
|
+
],
|
|
1157
|
+
example: '=NPV(0.1, -10000, 3000, 4200, 6800)',
|
|
1158
|
+
},
|
|
1159
|
+
{
|
|
1160
|
+
name: 'IRR',
|
|
1161
|
+
category: 'Financial',
|
|
1162
|
+
description: 'Returns the internal rate of return',
|
|
1163
|
+
syntax: 'IRR(values, [guess])',
|
|
1164
|
+
parameters: [
|
|
1165
|
+
{ name: 'values', description: 'Range of cash flows' },
|
|
1166
|
+
{ name: 'guess', description: 'Initial guess for rate', optional: true },
|
|
1167
|
+
],
|
|
1168
|
+
example: '=IRR(A1:A5)',
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
name: 'RATE',
|
|
1172
|
+
category: 'Financial',
|
|
1173
|
+
description: 'Returns the interest rate per period',
|
|
1174
|
+
syntax: 'RATE(nper, pmt, pv, [fv], [type], [guess])',
|
|
1175
|
+
parameters: [
|
|
1176
|
+
{ name: 'nper', description: 'Total number of periods' },
|
|
1177
|
+
{ name: 'pmt', description: 'Payment per period' },
|
|
1178
|
+
{ name: 'pv', description: 'Present value' },
|
|
1179
|
+
{ name: 'fv', description: 'Future value', optional: true },
|
|
1180
|
+
{ name: 'type', description: '0 = end, 1 = beginning', optional: true },
|
|
1181
|
+
{ name: 'guess', description: 'Initial guess', optional: true },
|
|
1182
|
+
],
|
|
1183
|
+
example: '=RATE(60, -100, 5000)',
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
name: 'NPER',
|
|
1187
|
+
category: 'Financial',
|
|
1188
|
+
description: 'Returns the number of periods for an investment',
|
|
1189
|
+
syntax: 'NPER(rate, pmt, pv, [fv], [type])',
|
|
1190
|
+
parameters: [
|
|
1191
|
+
{ name: 'rate', description: 'Interest rate per period' },
|
|
1192
|
+
{ name: 'pmt', description: 'Payment per period' },
|
|
1193
|
+
{ name: 'pv', description: 'Present value' },
|
|
1194
|
+
{ name: 'fv', description: 'Future value', optional: true },
|
|
1195
|
+
{ name: 'type', description: '0 = end, 1 = beginning', optional: true },
|
|
1196
|
+
],
|
|
1197
|
+
example: '=NPER(0.05/12, -100, 5000)',
|
|
1198
|
+
},
|
|
1199
|
+
];
|
|
1200
|
+
|
|
1201
|
+
// Get all formula names
|
|
1202
|
+
export const FORMULA_NAMES = FORMULA_DEFINITIONS.map((f) => f.name);
|
|
1203
|
+
|
|
1204
|
+
// Get formulas by category
|
|
1205
|
+
export const getFormulasByCategory = (category: FormulaCategory): FormulaDefinition[] =>
|
|
1206
|
+
FORMULA_DEFINITIONS.filter((f) => f.category === category);
|
|
1207
|
+
|
|
1208
|
+
// Search formulas by name prefix
|
|
1209
|
+
export const searchFormulas = (query: string): FormulaDefinition[] => {
|
|
1210
|
+
const upperQuery = query.toUpperCase();
|
|
1211
|
+
return FORMULA_DEFINITIONS.filter((f) => f.name.startsWith(upperQuery));
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
// Get formula by exact name
|
|
1215
|
+
export const getFormula = (name: string): FormulaDefinition | undefined =>
|
|
1216
|
+
FORMULA_DEFINITIONS.find((f) => f.name === name.toUpperCase());
|
|
1217
|
+
|
|
1218
|
+
// Get all categories
|
|
1219
|
+
export const FORMULA_CATEGORIES: FormulaCategory[] = [
|
|
1220
|
+
'Math',
|
|
1221
|
+
'Statistical',
|
|
1222
|
+
'Lookup',
|
|
1223
|
+
'Text',
|
|
1224
|
+
'Logical',
|
|
1225
|
+
'Date',
|
|
1226
|
+
'Information',
|
|
1227
|
+
'Financial',
|
|
1228
|
+
];
|