@@ -16,6 +16,7 @@ MR-Excel is a JavaScript library designed for reading and writing Excel files. T
1616 - [ ** ` General ` ** ] ( #general-option )
1717 - [ ** ` Header ` ** ] ( #header )
1818 - [ ** ` Formula ` ** ] ( #formula )
19+ - [ ** ` 🆕Time, Math, Custom Formula & etc ` ** ] ( #new-formula )
1920 - [ ** ` Styles & Format ` ** ] ( #styles-format )
2021 - [ ** ` Conditional Styling ` ** ] ( #conditional-styling )
2122 - [ ** ` Conditinal Formating ` ** ] ( #conditinal-formating )
@@ -2044,6 +2045,314 @@ ExcelTable.generateExcel(data);
20442045
20452046</details >
20462047
2048+ <a id =" new-formula " ></a >
2049+
2050+ ### 🆕Time, Math, Custom Formula & etc [ ⬆️] ( #table-of-contents )
2051+
2052+ We offer new formulas for mathematics, time, and more. Additionally, you can create complex formulas using the Custom Formula feature. One notable aspect of the Custom Formula feature is the ability to generate an array result formula. To achieve this, you must specify a range cell where the results are to be inserted and define the formula in the formula property. Moreover, you can use this feature to define a single result formula.
2053+
2054+ <details >
2055+ <summary >Display code</summary >
2056+
2057+ ``` javascript
2058+ const colorPalette = {
2059+ c1: " 2B2E4A" ,
2060+ c2: " E84545" ,
2061+ c3: " 903749" ,
2062+ c4: " 53354A" ,
2063+ };
2064+ const t = { c1: " 2C3639" , c2: " 3F4E4F" , c3: " A27B5C" , c4: " DCD7C9" },
2065+ n = { backgroundColor: t .c2 , fontFamily: " Times New Roman" , color: t .c4 },
2066+ a = { backgroundColor: t .c4 , fontFamily: " Times New Roman" , color: t .c2 };
2067+ const data = {
2068+ creator: " mr" ,
2069+ styles: {
2070+ headerStyle: {
2071+ backgroundColor: " 2B2E4A" ,
2072+ fontFamily: " Times New Roman" ,
2073+ color: " E84545" ,
2074+ },
2075+ Date : { ... n, format: " short_date" },
2076+ customFormulaStyle: {
2077+ backgroundColor: " E84545" ,
2078+ fontFamily: " Times New Roman" ,
2079+ color: " 2B2E4A" ,
2080+ size: 15 ,
2081+ border: {
2082+ full: {
2083+ color: " 53354A" ,
2084+ style: " dashDot" ,
2085+ },
2086+ },
2087+ },
2088+ formulaStyle: {
2089+ backgroundColor: " 2B2E4A" ,
2090+ fontFamily: " Times New Roman" ,
2091+ color: " E84545" ,
2092+ size: 15 ,
2093+ border: {
2094+ full: {
2095+ color: " 903749" ,
2096+ style: " medium" ,
2097+ },
2098+ },
2099+ },
2100+ },
2101+ sheet: [
2102+ {
2103+ formula: {
2104+ J7 : {
2105+ formula: " REPLACE(D3,1,1,\" replced\" )" ,
2106+ styleId: " customFormulaStyle"
2107+ },
2108+ H8 : {
2109+ formula: " CONCATENATE(D2, \" \" , D5)" ,
2110+ styleId: " customFormulaStyle"
2111+ },
2112+ " J2:J6" : {
2113+ formula: " YEAR(NOW()-A2:A6)" ,
2114+ refrenceCells: " J2:J6"
2115+ },
2116+ " K2:K6" : {
2117+ formula: " LOWER(D2:D6)"
2118+ },
2119+ I2 : {
2120+ formula: " COUNT(A1:B8)" ,
2121+ styleId: " customFormulaStyle"
2122+ },
2123+ H6 : {
2124+ noArgType: " HOUR" ,
2125+ styleId: " customFormulaStyle"
2126+ },
2127+ H5 : {
2128+ noArgType: " NOW" ,
2129+ styleId: " customFormulaStyle"
2130+ },
2131+ H4 : {
2132+ type: " TRIM" ,
2133+ refrenceCell: " D3" ,
2134+ styleId: " customFormulaStyle"
2135+ }, H7 : {
2136+ type: " SUMIF" ,
2137+ refrenceCell: " B1:B5" ,
2138+ value: " \" >=5\" " ,
2139+ styleId: " customFormulaStyle"
2140+ },
2141+ H3 : {
2142+ type: " COUNTIF" ,
2143+ refrenceCell: " B1:B5" ,
2144+ value: " \" >=5\" " ,
2145+ styleId: " customFormulaStyle"
2146+ },
2147+ H2 : {
2148+ type: " ABS" ,
2149+ refrenceCell: " B5" ,
2150+ styleId: " customFormulaStyle"
2151+ }, I1 : {
2152+ type: " PROPER" ,
2153+ refrenceCell: " D1" ,
2154+ styleId: " customFormulaStyle"
2155+ },
2156+ G11 : {
2157+ type: " UPPER" ,
2158+ refrenceCell: " D1" ,
2159+ styleId: " customFormulaStyle"
2160+ },
2161+ G10 : {
2162+ type: " TAN" ,
2163+ refrenceCell: " B5" ,
2164+ styleId: " customFormulaStyle"
2165+ },
2166+ G8 : {
2167+ type: " COS" ,
2168+ refrenceCell: " B5" ,
2169+ styleId: " customFormulaStyle"
2170+ },
2171+ G7 : {
2172+ type: " FLOOR" ,
2173+ refrenceCell: " B5" ,
2174+ value: 5 ,
2175+ styleId: " customFormulaStyle"
2176+ },
2177+ G2 : {
2178+ type: " POWER" ,
2179+ refrenceCell: " B2" ,
2180+ value: 2 ,
2181+ styleId: " customFormulaStyle"
2182+ },
2183+ G3 : {
2184+ type: " MOD" ,
2185+ refrenceCell: " B3" ,
2186+ value: 2 ,
2187+ styleId: " customFormulaStyle"
2188+ },
2189+ G4 : {
2190+ type: " SQRT" ,
2191+ refrenceCell: " B4" ,
2192+ styleId: " customFormulaStyle"
2193+ },
2194+ G5 : {
2195+ type: " CEILING" ,
2196+ refrenceCell: " B5" ,
2197+ value: 5 ,
2198+ styleId: " customFormulaStyle"
2199+ },
2200+ G6 : {
2201+ type: " ROUND" ,
2202+ refrenceCell: " B5" ,
2203+ value: 5 ,
2204+ styleId: " customFormulaStyle"
2205+ },
2206+ G1 : {
2207+ type: " LEN" ,
2208+ refrenceCell: " A1" ,
2209+ styleId: " customFormulaStyle" ,
2210+ },
2211+ A8 : {
2212+ type: " SUM" ,
2213+ start: " B2" ,
2214+ end: " D3" ,
2215+ styleId: " customFormulaStyle" ,
2216+ },
2217+ B8 : {
2218+ type: " AVERAGE" ,
2219+ start: " A2" ,
2220+ end: " F6" ,
2221+ styleId: " customFormulaStyle" ,
2222+ },
2223+ C8 : {
2224+ type: " SUM" ,
2225+ start: " A2" ,
2226+ end: " F6" ,
2227+ styleId: " customFormulaStyle" ,
2228+ },
2229+ D8 : {
2230+ type: " MAX" ,
2231+ start: " A2" ,
2232+ end: " F6" ,
2233+ styleId: " customFormulaStyle" ,
2234+ },
2235+ E8 : {
2236+ type: " MIN" ,
2237+ start: " A2" ,
2238+ end: " F6" ,
2239+ styleId: " customFormulaStyle" ,
2240+ },
2241+ F8 : {
2242+ type: " COUNT" ,
2243+ start: " A2" ,
2244+ end: " F6" ,
2245+ styleId: " customFormulaStyle" ,
2246+ },
2247+ },
2248+ headerStyleKey: " headerStyle" ,
2249+ headers: [
2250+ {
2251+ label: " Date" ,
2252+ text: " Date" ,
2253+ formula: {
2254+ styleId: " formulaStyle" ,
2255+ type: " COUNT" ,
2256+ },
2257+ },
2258+ {
2259+ label: " Column 1" ,
2260+ text: " Column 1" ,
2261+ formula: {
2262+ styleId: " formulaStyle" ,
2263+ type: " AVERAGE" ,
2264+ },
2265+ },
2266+ {
2267+ label: " Column 2" ,
2268+ text: " Column 2" ,
2269+ formula: {
2270+ styleId: " formulaStyle" ,
2271+ type: " SUM" ,
2272+ },
2273+ },
2274+ {
2275+ label: " Column 3" ,
2276+ text: " Column 3" ,
2277+ formula: {
2278+ styleId: " formulaStyle" ,
2279+ type: " MAX" ,
2280+ },
2281+ },
2282+ {
2283+ label: " Column 4" ,
2284+ text: " Column 4" ,
2285+ formula: {
2286+ styleId: " formulaStyle" ,
2287+ type: " MIN" ,
2288+ },
2289+ },
2290+ {
2291+ label: " Column 5" ,
2292+ text: " Column 5" ,
2293+ formula: {
2294+ styleId: " formulaStyle" ,
2295+ type: " COUNT" ,
2296+ },
2297+ },
2298+ ],
2299+ data: [
2300+ {
2301+ Date : " 2023-08-01" ,
2302+ " Column 1" : 5 ,
2303+ " Column 2" : 10 ,
2304+ " Column 3" : " D15" ,
2305+ " Column 4" : 20 ,
2306+ " Column 5" : 25 ,
2307+ },
2308+ {
2309+ Date : " 2023-08-02" ,
2310+ " Column 1" : 7 ,
2311+ " Column 2" : 14 ,
2312+ " Column 3" : " D21 " ,
2313+ " Column 4" : 28 ,
2314+ " Column 5" : 35 ,
2315+ },
2316+ {
2317+ Date : " 2023-08-03" ,
2318+ " Column 1" : 3 ,
2319+ " Column 2" : 6 ,
2320+ " Column 3" : " D9 " ,
2321+ " Column 4" : 12 ,
2322+ " Column 5" : 15 ,
2323+ },
2324+ {
2325+ Date : " 2023-08-04" ,
2326+ " Column 1" : 12 ,
2327+ " Column 2" : 24 ,
2328+ " Column 3" : " D36 " ,
2329+ " Column 4" : 48 ,
2330+ " Column 5" : 60 ,
2331+ },
2332+ {
2333+ Date : " 2023-08-05" ,
2334+ " Column 1" : 8 ,
2335+ " Column 2" : 16 ,
2336+ " Column 3" : " D24" ,
2337+ " Column 4" : 32 ,
2338+ " Column 5" : 40 ,
2339+ },
2340+ ],
2341+ },
2342+ ],
2343+ };
2344+ ExcelTable .generateExcel (data);
2345+ ```
2346+
2347+ </details >
2348+
2349+ <details >
2350+ <summary >result image</summary >
2351+
2352+ ![ ex] ( https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/img/ex22.PNG?raw=true )
2353+
2354+ </details >
2355+
20472356## Styles & Format Options [ ⬆️] ( #table-of-contents )
20482357
20492358<a id =" styles-format " ></a >
@@ -4538,6 +4847,12 @@ To migrate from Version 2 to Version 3, you need to follow the steps below:
45384847
45394848## Release Notes [ ⬆️] ( #table-of-contents )
45404849
4850+ ### Version 3.2.0 (2023-12-29)
4851+
4852+ #### New Features
4853+
4854+ -Improvement in the formula section.
4855+
45414856### Version 3.0.3 (2023-12-02)
45424857
45434858#### Bug Fixes
0 commit comments