calc_test.go 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610
  1. package excelize
  2. import (
  3. "container/list"
  4. "path/filepath"
  5. "strings"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "github.com/xuri/efp"
  9. )
  10. func prepareCalcData(cellData [][]interface{}) *File {
  11. f := NewFile()
  12. for r, row := range cellData {
  13. for c, value := range row {
  14. cell, _ := CoordinatesToCellName(c+1, r+1)
  15. _ = f.SetCellValue("Sheet1", cell, value)
  16. }
  17. }
  18. return f
  19. }
  20. func TestCalcCellValue(t *testing.T) {
  21. cellData := [][]interface{}{
  22. {1, 4, nil, "Month", "Team", "Sales"},
  23. {2, 5, nil, "Jan", "North 1", 36693},
  24. {3, nil, nil, "Jan", "North 2", 22100},
  25. {0, nil, nil, "Jan", "South 1", 53321},
  26. {nil, nil, nil, "Jan", "South 2", 34440},
  27. {nil, nil, nil, "Feb", "North 1", 29889},
  28. {nil, nil, nil, "Feb", "North 2", 50090},
  29. {nil, nil, nil, "Feb", "South 1", 32080},
  30. {nil, nil, nil, "Feb", "South 2", 45500},
  31. }
  32. mathCalc := map[string]string{
  33. "=2^3": "8",
  34. "=1=1": "TRUE",
  35. "=1=2": "FALSE",
  36. "=1<2": "TRUE",
  37. "=3<2": "FALSE",
  38. "=2<=3": "TRUE",
  39. "=2<=1": "FALSE",
  40. "=2>1": "TRUE",
  41. "=2>3": "FALSE",
  42. "=2>=1": "TRUE",
  43. "=2>=3": "FALSE",
  44. "=1&2": "12",
  45. `="A"="A"`: "TRUE",
  46. `="A"<>"A"`: "FALSE",
  47. // Engineering Functions
  48. // BESSELI
  49. "=BESSELI(4.5,1)": "15.389222753735925",
  50. "=BESSELI(32,1)": "5.502845511211247e+12",
  51. // BESSELJ
  52. "=BESSELJ(1.9,2)": "0.329925727692387",
  53. // BESSELK
  54. "=BESSELK(0.05,0)": "3.114234034289662",
  55. "=BESSELK(0.05,1)": "19.90967432724863",
  56. "=BESSELK(0.05,2)": "799.501207124235",
  57. "=BESSELK(3,2)": "0.061510458561912",
  58. // BESSELY
  59. "=BESSELY(0.05,0)": "-1.979311006841528",
  60. "=BESSELY(0.05,1)": "-12.789855163794034",
  61. "=BESSELY(0.05,2)": "-509.61489554491976",
  62. "=BESSELY(9,2)": "-0.229082087487741",
  63. // BIN2DEC
  64. "=BIN2DEC(\"10\")": "2",
  65. "=BIN2DEC(\"11\")": "3",
  66. "=BIN2DEC(\"0000000010\")": "2",
  67. "=BIN2DEC(\"1111111110\")": "-2",
  68. "=BIN2DEC(\"110\")": "6",
  69. // BIN2HEX
  70. "=BIN2HEX(\"10\")": "2",
  71. "=BIN2HEX(\"0000000001\")": "1",
  72. "=BIN2HEX(\"10\",10)": "0000000002",
  73. "=BIN2HEX(\"1111111110\")": "FFFFFFFFFE",
  74. "=BIN2HEX(\"11101\")": "1D",
  75. // BIN2OCT
  76. "=BIN2OCT(\"101\")": "5",
  77. "=BIN2OCT(\"0000000001\")": "1",
  78. "=BIN2OCT(\"10\",10)": "0000000002",
  79. "=BIN2OCT(\"1111111110\")": "7777777776",
  80. "=BIN2OCT(\"1110\")": "16",
  81. // BITAND
  82. "=BITAND(13,14)": "12",
  83. // BITLSHIFT
  84. "=BITLSHIFT(5,2)": "20",
  85. "=BITLSHIFT(3,5)": "96",
  86. // BITOR
  87. "=BITOR(9,12)": "13",
  88. // BITRSHIFT
  89. "=BITRSHIFT(20,2)": "5",
  90. "=BITRSHIFT(52,4)": "3",
  91. // BITXOR
  92. "=BITXOR(5,6)": "3",
  93. "=BITXOR(9,12)": "5",
  94. // COMPLEX
  95. "=COMPLEX(5,2)": "5+2i",
  96. "=COMPLEX(5,-9)": "5-9i",
  97. "=COMPLEX(-1,2,\"j\")": "-1+2j",
  98. "=COMPLEX(10,-5,\"i\")": "10-5i",
  99. "=COMPLEX(0,5)": "5i",
  100. "=COMPLEX(3,0)": "3",
  101. "=COMPLEX(0,-2)": "-2i",
  102. "=COMPLEX(0,0)": "0",
  103. "=COMPLEX(0,-1,\"j\")": "-j",
  104. // DEC2BIN
  105. "=DEC2BIN(2)": "10",
  106. "=DEC2BIN(3)": "11",
  107. "=DEC2BIN(2,10)": "0000000010",
  108. "=DEC2BIN(-2)": "1111111110",
  109. "=DEC2BIN(6)": "110",
  110. // DEC2HEX
  111. "=DEC2HEX(10)": "A",
  112. "=DEC2HEX(31)": "1F",
  113. "=DEC2HEX(16,10)": "0000000010",
  114. "=DEC2HEX(-16)": "FFFFFFFFF0",
  115. "=DEC2HEX(273)": "111",
  116. // DEC2OCT
  117. "=DEC2OCT(8)": "10",
  118. "=DEC2OCT(18)": "22",
  119. "=DEC2OCT(8,10)": "0000000010",
  120. "=DEC2OCT(-8)": "7777777770",
  121. "=DEC2OCT(237)": "355",
  122. // HEX2BIN
  123. "=HEX2BIN(\"2\")": "10",
  124. "=HEX2BIN(\"0000000001\")": "1",
  125. "=HEX2BIN(\"2\",10)": "0000000010",
  126. "=HEX2BIN(\"F0\")": "11110000",
  127. "=HEX2BIN(\"1D\")": "11101",
  128. // HEX2DEC
  129. "=HEX2DEC(\"A\")": "10",
  130. "=HEX2DEC(\"1F\")": "31",
  131. "=HEX2DEC(\"0000000010\")": "16",
  132. "=HEX2DEC(\"FFFFFFFFF0\")": "-16",
  133. "=HEX2DEC(\"111\")": "273",
  134. "=HEX2DEC(\"\")": "0",
  135. // HEX2OCT
  136. "=HEX2OCT(\"A\")": "12",
  137. "=HEX2OCT(\"000000000F\")": "17",
  138. "=HEX2OCT(\"8\",10)": "0000000010",
  139. "=HEX2OCT(\"FFFFFFFFF8\")": "7777777770",
  140. "=HEX2OCT(\"1F3\")": "763",
  141. // IMABS
  142. "=IMABS(\"2j\")": "2",
  143. "=IMABS(\"-1+2i\")": "2.23606797749979",
  144. "=IMABS(COMPLEX(-1,2,\"j\"))": "2.23606797749979",
  145. // IMAGINARY
  146. "=IMAGINARY(\"5+2i\")": "2",
  147. "=IMAGINARY(\"2-i\")": "-1",
  148. "=IMAGINARY(6)": "0",
  149. "=IMAGINARY(\"3i\")": "3",
  150. "=IMAGINARY(\"4+i\")": "1",
  151. // IMARGUMENT
  152. "=IMARGUMENT(\"5+2i\")": "0.380506377112365",
  153. "=IMARGUMENT(\"2-i\")": "-0.463647609000806",
  154. "=IMARGUMENT(6)": "0",
  155. // IMCONJUGATE
  156. "=IMCONJUGATE(\"5+2i\")": "5-2i",
  157. "=IMCONJUGATE(\"2-i\")": "2+i",
  158. "=IMCONJUGATE(6)": "6",
  159. "=IMCONJUGATE(\"3i\")": "-3i",
  160. "=IMCONJUGATE(\"4+i\")": "4-i",
  161. // IMCOS
  162. "=IMCOS(0)": "1",
  163. "=IMCOS(0.5)": "0.877582561890373",
  164. "=IMCOS(\"3+0.5i\")": "-1.1163412445261518-0.0735369737112366i",
  165. // IMCOSH
  166. "=IMCOSH(0.5)": "1.127625965206381",
  167. "=IMCOSH(\"3+0.5i\")": "8.835204606500994+4.802825082743033i",
  168. "=IMCOSH(\"2-i\")": "2.0327230070196656-3.0518977991518i",
  169. "=IMCOSH(COMPLEX(1,-1))": "0.8337300251311491-0.9888977057628651i",
  170. // IMCOT
  171. "=IMCOT(0.5)": "1.830487721712452",
  172. "=IMCOT(\"3+0.5i\")": "-0.4793455787473728-2.016092521506228i",
  173. "=IMCOT(\"2-i\")": "-0.171383612909185+0.8213297974938518i",
  174. "=IMCOT(COMPLEX(1,-1))": "0.21762156185440268+0.868014142895925i",
  175. // IMCSC
  176. "=IMCSC(\"j\")": "-0.8509181282393216i",
  177. // IMCSCH
  178. "=IMCSCH(COMPLEX(1,-1))": "0.30393100162842646+0.6215180171704284i",
  179. // IMDIV
  180. "=IMDIV(\"5+2i\",\"1+i\")": "3.5-1.5i",
  181. "=IMDIV(\"2+2i\",\"2+i\")": "1.2+0.4i",
  182. "=IMDIV(COMPLEX(5,2),COMPLEX(0,1))": "2-5i",
  183. // IMEXP
  184. "=IMEXP(0)": "1",
  185. "=IMEXP(0.5)": "1.648721270700128",
  186. "=IMEXP(\"1-2i\")": "-1.1312043837568135-2.4717266720048183i",
  187. "=IMEXP(COMPLEX(1,-1))": "1.4686939399158851-2.2873552871788423i",
  188. // IMLN
  189. "=IMLN(0.5)": "-0.693147180559945",
  190. "=IMLN(\"3+0.5i\")": "1.1123117757621668+0.16514867741462683i",
  191. "=IMLN(\"2-i\")": "0.8047189562170503-0.4636476090008061i",
  192. "=IMLN(COMPLEX(1,-1))": "0.3465735902799727-0.7853981633974483i",
  193. // IMLOG10
  194. "=IMLOG10(0.5)": "-0.301029995663981",
  195. "=IMLOG10(\"3+0.5i\")": "0.48307086636951624+0.07172315929479262i",
  196. "=IMLOG10(\"2-i\")": "0.34948500216800943-0.20135959813668655i",
  197. "=IMLOG10(COMPLEX(1,-1))": "0.1505149978319906-0.3410940884604603i",
  198. // IMREAL
  199. "=IMREAL(\"5+2i\")": "5",
  200. "=IMREAL(\"2+2i\")": "2",
  201. "=IMREAL(6)": "6",
  202. "=IMREAL(\"3i\")": "0",
  203. "=IMREAL(COMPLEX(4,1))": "4",
  204. // IMSEC
  205. "=IMSEC(0.5)": "1.139493927324549",
  206. "=IMSEC(\"3+0.5i\")": "-0.8919131797403304+0.05875317818173977i",
  207. "=IMSEC(\"2-i\")": "-0.4131493442669401-0.687527438655479i",
  208. "=IMSEC(COMPLEX(1,-1))": "0.49833703055518686-0.5910838417210451i",
  209. // IMSECH
  210. "=IMSECH(0.5)": "0.886818883970074",
  211. "=IMSECH(\"3+0.5i\")": "0.08736657796213027-0.047492549490160664i",
  212. "=IMSECH(\"2-i\")": "0.1511762982655772+0.22697367539372157i",
  213. "=IMSECH(COMPLEX(1,-1))": "0.49833703055518686+0.5910838417210451i",
  214. // IMSIN
  215. "=IMSIN(0.5)": "0.479425538604203",
  216. "=IMSIN(\"3+0.5i\")": "0.15913058529843999-0.5158804424525267i",
  217. "=IMSIN(\"2-i\")": "1.4031192506220405+0.4890562590412937i",
  218. "=IMSIN(COMPLEX(1,-1))": "1.2984575814159773-0.6349639147847361i",
  219. // IMSINH
  220. "=IMSINH(-0)": "0",
  221. "=IMSINH(0.5)": "0.521095305493747",
  222. "=IMSINH(\"3+0.5i\")": "8.791512343493714+4.82669427481082i",
  223. "=IMSINH(\"2-i\")": "1.9596010414216063-3.165778513216168i",
  224. "=IMSINH(COMPLEX(1,-1))": "0.6349639147847361-1.2984575814159773i",
  225. // IMSQRT
  226. "=IMSQRT(\"i\")": "0.7071067811865476+0.7071067811865476i",
  227. "=IMSQRT(\"2-i\")": "1.455346690225355-0.34356074972251244i",
  228. "=IMSQRT(\"5+2i\")": "2.27872385417085+0.4388421169022545i",
  229. "=IMSQRT(6)": "2.449489742783178",
  230. "=IMSQRT(\"-2-4i\")": "1.1117859405028423-1.7989074399478673i",
  231. // IMSUB
  232. "=IMSUB(\"5+i\",\"1+4i\")": "4-3i",
  233. "=IMSUB(\"9+2i\",6)": "3+2i",
  234. "=IMSUB(COMPLEX(5,2),COMPLEX(0,1))": "5+i",
  235. // IMSUM
  236. "=IMSUM(\"1-i\",\"5+10i\",2)": "8+9i",
  237. "=IMSUM(COMPLEX(5,2),COMPLEX(0,1))": "5+3i",
  238. // IMTAN
  239. "=IMTAN(-0)": "0",
  240. "=IMTAN(0.5)": "0.546302489843791",
  241. "=IMTAN(\"3+0.5i\")": "-0.11162105077158344+0.46946999342588536i",
  242. "=IMTAN(\"2-i\")": "-0.24345820118572523-1.16673625724092i",
  243. "=IMTAN(COMPLEX(1,-1))": "0.2717525853195117-1.0839233273386948i",
  244. // OCT2BIN
  245. "=OCT2BIN(\"5\")": "101",
  246. "=OCT2BIN(\"0000000001\")": "1",
  247. "=OCT2BIN(\"2\",10)": "0000000010",
  248. "=OCT2BIN(\"7777777770\")": "1111111000",
  249. "=OCT2BIN(\"16\")": "1110",
  250. // OCT2DEC
  251. "=OCT2DEC(\"10\")": "8",
  252. "=OCT2DEC(\"22\")": "18",
  253. "=OCT2DEC(\"0000000010\")": "8",
  254. "=OCT2DEC(\"7777777770\")": "-8",
  255. "=OCT2DEC(\"355\")": "237",
  256. // OCT2HEX
  257. "=OCT2HEX(\"10\")": "8",
  258. "=OCT2HEX(\"0000000007\")": "7",
  259. "=OCT2HEX(\"10\",10)": "0000000008",
  260. "=OCT2HEX(\"7777777770\")": "FFFFFFFFF8",
  261. "=OCT2HEX(\"763\")": "1F3",
  262. // Math and Trigonometric Functions
  263. // ABS
  264. "=ABS(-1)": "1",
  265. "=ABS(-6.5)": "6.5",
  266. "=ABS(6.5)": "6.5",
  267. "=ABS(0)": "0",
  268. "=ABS(2-4.5)": "2.5",
  269. "=ABS(ABS(-1))": "1",
  270. // ACOS
  271. "=ACOS(-1)": "3.141592653589793",
  272. "=ACOS(0)": "1.570796326794897",
  273. "=ACOS(ABS(0))": "1.570796326794897",
  274. // ACOSH
  275. "=ACOSH(1)": "0",
  276. "=ACOSH(2.5)": "1.566799236972411",
  277. "=ACOSH(5)": "2.292431669561178",
  278. "=ACOSH(ACOSH(5))": "1.471383321536679",
  279. // ACOT
  280. "=_xlfn.ACOT(1)": "0.785398163397448",
  281. "=_xlfn.ACOT(-2)": "2.677945044588987",
  282. "=_xlfn.ACOT(0)": "1.570796326794897",
  283. "=_xlfn.ACOT(_xlfn.ACOT(0))": "0.566911504941009",
  284. // ACOTH
  285. "=_xlfn.ACOTH(-5)": "-0.202732554054082",
  286. "=_xlfn.ACOTH(1.1)": "1.522261218861711",
  287. "=_xlfn.ACOTH(2)": "0.549306144334055",
  288. "=_xlfn.ACOTH(ABS(-2))": "0.549306144334055",
  289. // ARABIC
  290. "=_xlfn.ARABIC(\"IV\")": "4",
  291. "=_xlfn.ARABIC(\"-IV\")": "-4",
  292. "=_xlfn.ARABIC(\"MCXX\")": "1120",
  293. "=_xlfn.ARABIC(\"\")": "0",
  294. "=_xlfn.ARABIC(\" ll lc \")": "-50",
  295. // ASIN
  296. "=ASIN(-1)": "-1.570796326794897",
  297. "=ASIN(0)": "0",
  298. "=ASIN(ASIN(0))": "0",
  299. // ASINH
  300. "=ASINH(0)": "0",
  301. "=ASINH(-0.5)": "-0.481211825059604",
  302. "=ASINH(2)": "1.44363547517881",
  303. "=ASINH(ASINH(0))": "0",
  304. // ATAN
  305. "=ATAN(-1)": "-0.785398163397448",
  306. "=ATAN(0)": "0",
  307. "=ATAN(1)": "0.785398163397448",
  308. "=ATAN(ATAN(0))": "0",
  309. // ATANH
  310. "=ATANH(-0.8)": "-1.09861228866811",
  311. "=ATANH(0)": "0",
  312. "=ATANH(0.5)": "0.549306144334055",
  313. "=ATANH(ATANH(0))": "0",
  314. // ATAN2
  315. "=ATAN2(1,1)": "0.785398163397448",
  316. "=ATAN2(1,-1)": "-0.785398163397448",
  317. "=ATAN2(4,0)": "0",
  318. "=ATAN2(4,ATAN2(4,0))": "0",
  319. // BASE
  320. "=BASE(12,2)": "1100",
  321. "=BASE(12,2,8)": "00001100",
  322. "=BASE(100000,16)": "186A0",
  323. "=BASE(BASE(12,2),16)": "44C",
  324. // CEILING
  325. "=CEILING(22.25,0.1)": "22.3",
  326. "=CEILING(22.25,0.5)": "22.5",
  327. "=CEILING(22.25,1)": "23",
  328. "=CEILING(22.25,10)": "30",
  329. "=CEILING(22.25,20)": "40",
  330. "=CEILING(-22.25,-0.1)": "-22.3",
  331. "=CEILING(-22.25,-1)": "-23",
  332. "=CEILING(-22.25,-5)": "-25",
  333. "=CEILING(22.25)": "23",
  334. "=CEILING(CEILING(22.25,0.1),0.1)": "22.3",
  335. // _xlfn.CEILING.MATH
  336. "=_xlfn.CEILING.MATH(15.25,1)": "16",
  337. "=_xlfn.CEILING.MATH(15.25,0.1)": "15.3",
  338. "=_xlfn.CEILING.MATH(15.25,5)": "20",
  339. "=_xlfn.CEILING.MATH(-15.25,1)": "-15",
  340. "=_xlfn.CEILING.MATH(-15.25,1,1)": "-15", // should be 16
  341. "=_xlfn.CEILING.MATH(-15.25,10)": "-10",
  342. "=_xlfn.CEILING.MATH(-15.25)": "-15",
  343. "=_xlfn.CEILING.MATH(-15.25,-5,-1)": "-10",
  344. "=_xlfn.CEILING.MATH(_xlfn.CEILING.MATH(15.25,1),1)": "16",
  345. // _xlfn.CEILING.PRECISE
  346. "=_xlfn.CEILING.PRECISE(22.25,0.1)": "22.3",
  347. "=_xlfn.CEILING.PRECISE(22.25,0.5)": "22.5",
  348. "=_xlfn.CEILING.PRECISE(22.25,1)": "23",
  349. "=_xlfn.CEILING.PRECISE(22.25)": "23",
  350. "=_xlfn.CEILING.PRECISE(22.25,10)": "30",
  351. "=_xlfn.CEILING.PRECISE(22.25,0)": "0",
  352. "=_xlfn.CEILING.PRECISE(-22.25,1)": "-22",
  353. "=_xlfn.CEILING.PRECISE(-22.25,-1)": "-22",
  354. "=_xlfn.CEILING.PRECISE(-22.25,5)": "-20",
  355. "=_xlfn.CEILING.PRECISE(_xlfn.CEILING.PRECISE(22.25,0.1),5)": "25",
  356. // COMBIN
  357. "=COMBIN(6,1)": "6",
  358. "=COMBIN(6,2)": "15",
  359. "=COMBIN(6,3)": "20",
  360. "=COMBIN(6,4)": "15",
  361. "=COMBIN(6,5)": "6",
  362. "=COMBIN(6,6)": "1",
  363. "=COMBIN(0,0)": "1",
  364. "=COMBIN(6,COMBIN(0,0))": "6",
  365. // _xlfn.COMBINA
  366. "=_xlfn.COMBINA(6,1)": "6",
  367. "=_xlfn.COMBINA(6,2)": "21",
  368. "=_xlfn.COMBINA(6,3)": "56",
  369. "=_xlfn.COMBINA(6,4)": "126",
  370. "=_xlfn.COMBINA(6,5)": "252",
  371. "=_xlfn.COMBINA(6,6)": "462",
  372. "=_xlfn.COMBINA(0,0)": "0",
  373. "=_xlfn.COMBINA(0,_xlfn.COMBINA(0,0))": "0",
  374. // COS
  375. "=COS(0.785398163)": "0.707106781467586",
  376. "=COS(0)": "1",
  377. "=COS(COS(0))": "0.54030230586814",
  378. // COSH
  379. "=COSH(0)": "1",
  380. "=COSH(0.5)": "1.127625965206381",
  381. "=COSH(-2)": "3.762195691083632",
  382. "=COSH(COSH(0))": "1.543080634815244",
  383. // _xlfn.COT
  384. "=_xlfn.COT(0.785398163397448)": "1.000000000000001",
  385. "=_xlfn.COT(_xlfn.COT(0.45))": "-0.545473116787229",
  386. // _xlfn.COTH
  387. "=_xlfn.COTH(-3.14159265358979)": "-1.003741873197322",
  388. "=_xlfn.COTH(_xlfn.COTH(1))": "1.156014018113954",
  389. // _xlfn.CSC
  390. "=_xlfn.CSC(-6)": "3.578899547254406",
  391. "=_xlfn.CSC(1.5707963267949)": "1",
  392. "=_xlfn.CSC(_xlfn.CSC(1))": "1.077851840310882",
  393. // _xlfn.CSCH
  394. "=_xlfn.CSCH(-3.14159265358979)": "-0.086589537530047",
  395. "=_xlfn.CSCH(_xlfn.CSCH(1))": "1.044510103955183",
  396. // _xlfn.DECIMAL
  397. `=_xlfn.DECIMAL("1100",2)`: "12",
  398. `=_xlfn.DECIMAL("186A0",16)`: "100000",
  399. `=_xlfn.DECIMAL("31L0",32)`: "100000",
  400. `=_xlfn.DECIMAL("70122",8)`: "28754",
  401. `=_xlfn.DECIMAL("0x70122",8)`: "28754",
  402. // DEGREES
  403. "=DEGREES(1)": "57.29577951308232",
  404. "=DEGREES(2.5)": "143.2394487827058",
  405. "=DEGREES(DEGREES(1))": "3282.806350011744",
  406. // EVEN
  407. "=EVEN(23)": "24",
  408. "=EVEN(2.22)": "4",
  409. "=EVEN(0)": "0",
  410. "=EVEN(-0.3)": "-2",
  411. "=EVEN(-11)": "-12",
  412. "=EVEN(-4)": "-4",
  413. "=EVEN((0))": "0",
  414. // EXP
  415. "=EXP(100)": "2.6881171418161356E+43",
  416. "=EXP(0.1)": "1.105170918075648",
  417. "=EXP(0)": "1",
  418. "=EXP(-5)": "0.006737946999085",
  419. "=EXP(EXP(0))": "2.718281828459045",
  420. // FACT
  421. "=FACT(3)": "6",
  422. "=FACT(6)": "720",
  423. "=FACT(10)": "3.6288e+06",
  424. "=FACT(FACT(3))": "720",
  425. // FACTDOUBLE
  426. "=FACTDOUBLE(5)": "15",
  427. "=FACTDOUBLE(8)": "384",
  428. "=FACTDOUBLE(13)": "135135",
  429. "=FACTDOUBLE(FACTDOUBLE(1))": "1",
  430. // FLOOR
  431. "=FLOOR(26.75,0.1)": "26.700000000000003",
  432. "=FLOOR(26.75,0.5)": "26.5",
  433. "=FLOOR(26.75,1)": "26",
  434. "=FLOOR(26.75,10)": "20",
  435. "=FLOOR(26.75,20)": "20",
  436. "=FLOOR(-26.75,-0.1)": "-26.700000000000003",
  437. "=FLOOR(-26.75,-1)": "-26",
  438. "=FLOOR(-26.75,-5)": "-25",
  439. "=FLOOR(FLOOR(26.75,1),1)": "26",
  440. // _xlfn.FLOOR.MATH
  441. "=_xlfn.FLOOR.MATH(58.55)": "58",
  442. "=_xlfn.FLOOR.MATH(58.55,0.1)": "58.5",
  443. "=_xlfn.FLOOR.MATH(58.55,5)": "55",
  444. "=_xlfn.FLOOR.MATH(58.55,1,1)": "58",
  445. "=_xlfn.FLOOR.MATH(-58.55,1)": "-59",
  446. "=_xlfn.FLOOR.MATH(-58.55,1,-1)": "-58",
  447. "=_xlfn.FLOOR.MATH(-58.55,1,1)": "-59", // should be -58
  448. "=_xlfn.FLOOR.MATH(-58.55,10)": "-60",
  449. "=_xlfn.FLOOR.MATH(_xlfn.FLOOR.MATH(1),10)": "0",
  450. // _xlfn.FLOOR.PRECISE
  451. "=_xlfn.FLOOR.PRECISE(26.75,0.1)": "26.700000000000003",
  452. "=_xlfn.FLOOR.PRECISE(26.75,0.5)": "26.5",
  453. "=_xlfn.FLOOR.PRECISE(26.75,1)": "26",
  454. "=_xlfn.FLOOR.PRECISE(26.75)": "26",
  455. "=_xlfn.FLOOR.PRECISE(26.75,10)": "20",
  456. "=_xlfn.FLOOR.PRECISE(26.75,0)": "0",
  457. "=_xlfn.FLOOR.PRECISE(-26.75,1)": "-27",
  458. "=_xlfn.FLOOR.PRECISE(-26.75,-1)": "-27",
  459. "=_xlfn.FLOOR.PRECISE(-26.75,-5)": "-30",
  460. "=_xlfn.FLOOR.PRECISE(_xlfn.FLOOR.PRECISE(26.75),-5)": "25",
  461. // GCD
  462. "=GCD(0)": "0",
  463. "=GCD(1,0)": "1",
  464. "=GCD(1,5)": "1",
  465. "=GCD(15,10,25)": "5",
  466. "=GCD(0,8,12)": "4",
  467. "=GCD(7,2)": "1",
  468. "=GCD(1,GCD(1))": "1",
  469. // INT
  470. "=INT(100.9)": "100",
  471. "=INT(5.22)": "5",
  472. "=INT(5.99)": "5",
  473. "=INT(-6.1)": "-7",
  474. "=INT(-100.9)": "-101",
  475. "=INT(INT(0))": "0",
  476. // ISO.CEILING
  477. "=ISO.CEILING(22.25)": "23",
  478. "=ISO.CEILING(22.25,1)": "23",
  479. "=ISO.CEILING(22.25,0.1)": "22.3",
  480. "=ISO.CEILING(22.25,10)": "30",
  481. "=ISO.CEILING(-22.25,1)": "-22",
  482. "=ISO.CEILING(-22.25,0.1)": "-22.200000000000003",
  483. "=ISO.CEILING(-22.25,5)": "-20",
  484. "=ISO.CEILING(-22.25,0)": "0",
  485. "=ISO.CEILING(1,ISO.CEILING(1,0))": "0",
  486. // LCM
  487. "=LCM(1,5)": "5",
  488. "=LCM(15,10,25)": "150",
  489. "=LCM(1,8,12)": "24",
  490. "=LCM(7,2)": "14",
  491. "=LCM(7)": "7",
  492. `=LCM("",1)`: "1",
  493. `=LCM(0,0)`: "0",
  494. `=LCM(0,LCM(0,0))`: "0",
  495. // LN
  496. "=LN(1)": "0",
  497. "=LN(100)": "4.605170185988092",
  498. "=LN(0.5)": "-0.693147180559945",
  499. "=LN(LN(100))": "1.527179625807901",
  500. // LOG
  501. "=LOG(64,2)": "6",
  502. "=LOG(100)": "2",
  503. "=LOG(4,0.5)": "-2",
  504. "=LOG(500)": "2.698970004336019",
  505. "=LOG(LOG(100))": "0.301029995663981",
  506. // LOG10
  507. "=LOG10(100)": "2",
  508. "=LOG10(1000)": "3",
  509. "=LOG10(0.001)": "-3",
  510. "=LOG10(25)": "1.397940008672038",
  511. "=LOG10(LOG10(100))": "0.301029995663981",
  512. // IMLOG2
  513. "=IMLOG2(\"5+2i\")": "2.4289904975637864+0.5489546632866347i",
  514. "=IMLOG2(\"2-i\")": "1.1609640474436813-0.6689021062254881i",
  515. "=IMLOG2(6)": "2.584962500721156",
  516. "=IMLOG2(\"3i\")": "1.584962500721156+2.266180070913597i",
  517. "=IMLOG2(\"4+i\")": "2.04373142062517+0.3534295024167349i",
  518. // IMPOWER
  519. "=IMPOWER(\"2-i\",2)": "3.000000000000001-4i",
  520. "=IMPOWER(\"2-i\",3)": "2.0000000000000018-11.000000000000002i",
  521. "=IMPOWER(9,0.5)": "3",
  522. "=IMPOWER(\"2+4i\",-2)": "-0.029999999999999985-0.039999999999999994i",
  523. // IMPRODUCT
  524. "=IMPRODUCT(3,6)": "18",
  525. `=IMPRODUCT("",3,SUM(6))`: "18",
  526. "=IMPRODUCT(\"1-i\",\"5+10i\",2)": "30+10i",
  527. "=IMPRODUCT(COMPLEX(5,2),COMPLEX(0,1))": "-2+5i",
  528. "=IMPRODUCT(A1:C1)": "4",
  529. // MOD
  530. "=MOD(6,4)": "2",
  531. "=MOD(6,3)": "0",
  532. "=MOD(6,2.5)": "1",
  533. "=MOD(6,1.333)": "0.668",
  534. "=MOD(-10.23,1)": "0.77",
  535. "=MOD(MOD(1,1),1)": "0",
  536. // MROUND
  537. "=MROUND(333.7,0.5)": "333.5",
  538. "=MROUND(333.8,1)": "334",
  539. "=MROUND(333.3,2)": "334",
  540. "=MROUND(555.3,400)": "400",
  541. "=MROUND(555,1000)": "1000",
  542. "=MROUND(-555.7,-1)": "-556",
  543. "=MROUND(-555.4,-1)": "-555",
  544. "=MROUND(-1555,-1000)": "-2000",
  545. "=MROUND(MROUND(1,1),1)": "1",
  546. // MULTINOMIAL
  547. "=MULTINOMIAL(3,1,2,5)": "27720",
  548. `=MULTINOMIAL("",3,1,2,5)`: "27720",
  549. "=MULTINOMIAL(MULTINOMIAL(1))": "1",
  550. // _xlfn.MUNIT
  551. "=_xlfn.MUNIT(4)": "",
  552. // ODD
  553. "=ODD(22)": "23",
  554. "=ODD(1.22)": "3",
  555. "=ODD(1.22+4)": "7",
  556. "=ODD(0)": "1",
  557. "=ODD(-1.3)": "-3",
  558. "=ODD(-10)": "-11",
  559. "=ODD(-3)": "-3",
  560. "=ODD(ODD(1))": "1",
  561. // PI
  562. "=PI()": "3.141592653589793",
  563. // POWER
  564. "=POWER(4,2)": "16",
  565. "=POWER(4,POWER(1,1))": "4",
  566. // PRODUCT
  567. "=PRODUCT(3,6)": "18",
  568. `=PRODUCT("",3,6)`: "18",
  569. `=PRODUCT(PRODUCT(1),3,6)`: "18",
  570. // QUOTIENT
  571. "=QUOTIENT(5,2)": "2",
  572. "=QUOTIENT(4.5,3.1)": "1",
  573. "=QUOTIENT(-10,3)": "-3",
  574. "=QUOTIENT(QUOTIENT(1,2),3)": "0",
  575. // RADIANS
  576. "=RADIANS(50)": "0.872664625997165",
  577. "=RADIANS(-180)": "-3.141592653589793",
  578. "=RADIANS(180)": "3.141592653589793",
  579. "=RADIANS(360)": "6.283185307179586",
  580. "=RADIANS(RADIANS(360))": "0.109662271123215",
  581. // ROMAN
  582. "=ROMAN(499,0)": "CDXCIX",
  583. "=ROMAN(1999,0)": "MCMXCIX",
  584. "=ROMAN(1999,1)": "MLMVLIV",
  585. "=ROMAN(1999,2)": "MXMIX",
  586. "=ROMAN(1999,3)": "MVMIV",
  587. "=ROMAN(1999,4)": "MIM",
  588. "=ROMAN(1999,-1)": "MCMXCIX",
  589. "=ROMAN(1999,5)": "MIM",
  590. "=ROMAN(1999,ODD(1))": "MLMVLIV",
  591. // ROUND
  592. "=ROUND(100.319,1)": "100.30000000000001",
  593. "=ROUND(5.28,1)": "5.300000000000001",
  594. "=ROUND(5.9999,3)": "6.000000000000002",
  595. "=ROUND(99.5,0)": "100",
  596. "=ROUND(-6.3,0)": "-6",
  597. "=ROUND(-100.5,0)": "-101",
  598. "=ROUND(-22.45,1)": "-22.5",
  599. "=ROUND(999,-1)": "1000",
  600. "=ROUND(991,-1)": "990",
  601. "=ROUND(ROUND(100,1),-1)": "100",
  602. // ROUNDDOWN
  603. "=ROUNDDOWN(99.999,1)": "99.9",
  604. "=ROUNDDOWN(99.999,2)": "99.99000000000002",
  605. "=ROUNDDOWN(99.999,0)": "99",
  606. "=ROUNDDOWN(99.999,-1)": "90",
  607. "=ROUNDDOWN(-99.999,2)": "-99.99000000000002",
  608. "=ROUNDDOWN(-99.999,-1)": "-90",
  609. "=ROUNDDOWN(ROUNDDOWN(100,1),-1)": "100",
  610. // ROUNDUP`
  611. "=ROUNDUP(11.111,1)": "11.200000000000001",
  612. "=ROUNDUP(11.111,2)": "11.120000000000003",
  613. "=ROUNDUP(11.111,0)": "12",
  614. "=ROUNDUP(11.111,-1)": "20",
  615. "=ROUNDUP(-11.111,2)": "-11.120000000000003",
  616. "=ROUNDUP(-11.111,-1)": "-20",
  617. "=ROUNDUP(ROUNDUP(100,1),-1)": "100",
  618. // SEC
  619. "=_xlfn.SEC(-3.14159265358979)": "-1",
  620. "=_xlfn.SEC(0)": "1",
  621. "=_xlfn.SEC(_xlfn.SEC(0))": "0.54030230586814",
  622. // SECH
  623. "=_xlfn.SECH(-3.14159265358979)": "0.086266738334055",
  624. "=_xlfn.SECH(0)": "1",
  625. "=_xlfn.SECH(_xlfn.SECH(0))": "0.648054273663886",
  626. // SIGN
  627. "=SIGN(9.5)": "1",
  628. "=SIGN(-9.5)": "-1",
  629. "=SIGN(0)": "0",
  630. "=SIGN(0.00000001)": "1",
  631. "=SIGN(6-7)": "-1",
  632. "=SIGN(SIGN(-1))": "-1",
  633. // SIN
  634. "=SIN(0.785398163)": "0.707106780905509",
  635. "=SIN(SIN(1))": "0.745624141665558",
  636. // SINH
  637. "=SINH(0)": "0",
  638. "=SINH(0.5)": "0.521095305493747",
  639. "=SINH(-2)": "-3.626860407847019",
  640. "=SINH(SINH(0))": "0",
  641. // SQRT
  642. "=SQRT(4)": "2",
  643. "=SQRT(SQRT(16))": "2",
  644. // SQRTPI
  645. "=SQRTPI(5)": "3.963327297606011",
  646. "=SQRTPI(0.2)": "0.792665459521202",
  647. "=SQRTPI(100)": "17.72453850905516",
  648. "=SQRTPI(0)": "0",
  649. "=SQRTPI(SQRTPI(0))": "0",
  650. // STDEV
  651. "=STDEV(F2:F9)": "10724.978287523809",
  652. "=STDEV(MUNIT(2))": "0.577350269189626",
  653. "=STDEV(0,INT(0))": "0",
  654. "=STDEV(INT(1),INT(1))": "0",
  655. // STDEV.S
  656. "=STDEV.S(F2:F9)": "10724.978287523809",
  657. // STDEVA
  658. "=STDEVA(F2:F9)": "10724.978287523809",
  659. "=STDEVA(MUNIT(2))": "0.577350269189626",
  660. "=STDEVA(0,INT(0))": "0",
  661. // POISSON.DIST
  662. "=POISSON.DIST(20,25,FALSE)": "0.051917468608491",
  663. "=POISSON.DIST(35,40,TRUE)": "0.242414197690103",
  664. // POISSON
  665. "=POISSON(20,25,FALSE)": "0.051917468608491",
  666. "=POISSON(35,40,TRUE)": "0.242414197690103",
  667. // SUM
  668. "=SUM(1,2)": "3",
  669. `=SUM("",1,2)`: "3",
  670. "=SUM(1,2+3)": "6",
  671. "=SUM(SUM(1,2),2)": "5",
  672. "=(-2-SUM(-4+7))*5": "-25",
  673. "SUM(1,2,3,4,5,6,7)": "28",
  674. "=SUM(1,2)+SUM(1,2)": "6",
  675. "=1+SUM(SUM(1,2*3),4)": "12",
  676. "=1+SUM(SUM(1,-2*3),4)": "0",
  677. "=(-2-SUM(-4*(7+7)))*5": "270",
  678. "=SUM(SUM(1+2/1)*2-3/2,2)": "6.5",
  679. "=((3+5*2)+3)/5+(-6)/4*2+3": "3.2",
  680. "=1+SUM(SUM(1,2*3),4)*-4/2+5+(4+2)*3": "2",
  681. "=1+SUM(SUM(1,2*3),4)*4/3+5+(4+2)*3": "38.666666666666664",
  682. // SUMIF
  683. `=SUMIF(F1:F5, "")`: "0",
  684. `=SUMIF(A1:A5, "3")`: "3",
  685. `=SUMIF(F1:F5, "=36693")`: "36693",
  686. `=SUMIF(F1:F5, "<100")`: "0",
  687. `=SUMIF(F1:F5, "<=36693")`: "93233",
  688. `=SUMIF(F1:F5, ">100")`: "146554",
  689. `=SUMIF(F1:F5, ">=100")`: "146554",
  690. `=SUMIF(F1:F5, ">=text")`: "0",
  691. `=SUMIF(F1:F5, "*Jan",F2:F5)`: "0",
  692. `=SUMIF(D3:D7,"Jan",F2:F5)`: "112114",
  693. `=SUMIF(D2:D9,"Feb",F2:F9)`: "157559",
  694. `=SUMIF(E2:E9,"North 1",F2:F9)`: "66582",
  695. `=SUMIF(E2:E9,"North*",F2:F9)`: "138772",
  696. // SUMSQ
  697. "=SUMSQ(A1:A4)": "14",
  698. "=SUMSQ(A1,B1,A2,B2,6)": "82",
  699. `=SUMSQ("",A1,B1,A2,B2,6)`: "82",
  700. `=SUMSQ(1,SUMSQ(1))`: "2",
  701. "=SUMSQ(MUNIT(3))": "0",
  702. // TAN
  703. "=TAN(1.047197551)": "1.732050806782486",
  704. "=TAN(0)": "0",
  705. "=TAN(TAN(0))": "0",
  706. // TANH
  707. "=TANH(0)": "0",
  708. "=TANH(0.5)": "0.46211715726001",
  709. "=TANH(-2)": "-0.964027580075817",
  710. "=TANH(TANH(0))": "0",
  711. // TRUNC
  712. "=TRUNC(99.999,1)": "99.9",
  713. "=TRUNC(99.999,2)": "99.99",
  714. "=TRUNC(99.999)": "99",
  715. "=TRUNC(99.999,-1)": "90",
  716. "=TRUNC(-99.999,2)": "-99.99",
  717. "=TRUNC(-99.999,-1)": "-90",
  718. "=TRUNC(TRUNC(1),-1)": "0",
  719. // Statistical Functions
  720. // AVERAGE
  721. "=AVERAGE(INT(1))": "1",
  722. "=AVERAGE(A1)": "1",
  723. "=AVERAGE(A1:A2)": "1.5",
  724. "=AVERAGE(D2:F9)": "38014.125",
  725. // AVERAGEA
  726. "=AVERAGEA(INT(1))": "1",
  727. "=AVERAGEA(A1)": "1",
  728. "=AVERAGEA(A1:A2)": "1.5",
  729. "=AVERAGEA(D2:F9)": "12671.375",
  730. // COUNT
  731. "=COUNT()": "0",
  732. "=COUNT(E1:F2,\"text\",1,INT(2))": "3",
  733. // COUNTA
  734. "=COUNTA()": "0",
  735. "=COUNTA(A1:A5,B2:B5,\"text\",1,INT(2))": "8",
  736. "=COUNTA(COUNTA(1),MUNIT(1))": "2",
  737. // COUNTBLANK
  738. "=COUNTBLANK(MUNIT(1))": "0",
  739. "=COUNTBLANK(1)": "0",
  740. "=COUNTBLANK(B1:C1)": "1",
  741. "=COUNTBLANK(C1)": "1",
  742. // FISHER
  743. "=FISHER(-0.9)": "-1.47221948958322",
  744. "=FISHER(-0.25)": "-0.255412811882995",
  745. "=FISHER(0.8)": "1.09861228866811",
  746. "=FISHER(INT(0))": "0",
  747. // FISHERINV
  748. "=FISHERINV(-0.2)": "-0.197375320224904",
  749. "=FISHERINV(INT(0))": "0",
  750. "=FISHERINV(2.8)": "0.992631520201128",
  751. // GAMMA
  752. "=GAMMA(0.1)": "9.513507698668732",
  753. "=GAMMA(INT(1))": "1",
  754. "=GAMMA(1.5)": "0.886226925452758",
  755. "=GAMMA(5.5)": "52.34277778455352",
  756. // GAMMALN
  757. "=GAMMALN(4.5)": "2.453736570842443",
  758. "=GAMMALN(INT(1))": "0",
  759. // HARMEAN
  760. "=HARMEAN(2.5,3,0.5,1,3)": "1.229508196721312",
  761. "=HARMEAN(\"2.5\",3,0.5,1,INT(3),\"\")": "1.229508196721312",
  762. // KURT
  763. "=KURT(F1:F9)": "-1.033503502551368",
  764. "=KURT(F1,F2:F9)": "-1.033503502551368",
  765. "=KURT(INT(1),MUNIT(2))": "-3.333333333333336",
  766. // NORM.DIST
  767. "=NORM.DIST(0.8,1,0.3,TRUE)": "0.252492537546923",
  768. "=NORM.DIST(50,40,20,FALSE)": "0.017603266338215",
  769. // NORMDIST
  770. "=NORMDIST(0.8,1,0.3,TRUE)": "0.252492537546923",
  771. "=NORMDIST(50,40,20,FALSE)": "0.017603266338215",
  772. // NORM.INV
  773. "=NORM.INV(0.6,5,2)": "5.506694205719997",
  774. // NORMINV
  775. "=NORMINV(0.6,5,2)": "5.506694205719997",
  776. "=NORMINV(0.99,40,1.5)": "43.489521811582044",
  777. "=NORMINV(0.02,40,1.5)": "36.91937663649545",
  778. // NORM.S.DIST
  779. "=NORM.S.DIST(0.8,TRUE)": "0.788144601416603",
  780. // NORMSDIST
  781. "=NORMSDIST(1.333333)": "0.908788725604095",
  782. "=NORMSDIST(0)": "0.5",
  783. // NORM.S.INV
  784. "=NORM.S.INV(0.25)": "-0.674489750223423",
  785. // NORMSINV
  786. "=NORMSINV(0.25)": "-0.674489750223423",
  787. // LARGE
  788. "=LARGE(A1:A5,1)": "3",
  789. "=LARGE(A1:B5,2)": "4",
  790. "=LARGE(A1,1)": "1",
  791. "=LARGE(A1:F2,1)": "36693",
  792. // MAX
  793. "=MAX(1)": "1",
  794. "=MAX(TRUE())": "1",
  795. "=MAX(0.5,TRUE())": "1",
  796. "=MAX(FALSE())": "0",
  797. "=MAX(MUNIT(2))": "1",
  798. "=MAX(INT(1))": "1",
  799. // MAXA
  800. "=MAXA(1)": "1",
  801. "=MAXA(TRUE())": "1",
  802. "=MAXA(0.5,TRUE())": "1",
  803. "=MAXA(FALSE())": "0",
  804. "=MAXA(MUNIT(2))": "1",
  805. "=MAXA(INT(1))": "1",
  806. "=MAXA(A1:B4,MUNIT(1),INT(0),1,E1:F2,\"\")": "36693",
  807. // MEDIAN
  808. "=MEDIAN(A1:A5,12)": "2",
  809. "=MEDIAN(A1:A5)": "1.5",
  810. "=MEDIAN(A1:A5,MEDIAN(A1:A5,12))": "2",
  811. // MIN
  812. "=MIN(1)": "1",
  813. "=MIN(TRUE())": "1",
  814. "=MIN(0.5,FALSE())": "0",
  815. "=MIN(FALSE())": "0",
  816. "=MIN(MUNIT(2))": "0",
  817. "=MIN(INT(1))": "1",
  818. // MINA
  819. "=MINA(1)": "1",
  820. "=MINA(TRUE())": "1",
  821. "=MINA(0.5,FALSE())": "0",
  822. "=MINA(FALSE())": "0",
  823. "=MINA(MUNIT(2))": "0",
  824. "=MINA(INT(1))": "1",
  825. "=MINA(A1:B4,MUNIT(1),INT(0),1,E1:F2,\"\")": "0",
  826. // PERCENTILE.INC
  827. "=PERCENTILE.INC(A1:A4,0.2)": "0.6",
  828. // PERCENTILE
  829. "=PERCENTILE(A1:A4,0.2)": "0.6",
  830. "=PERCENTILE(0,0)": "0",
  831. // PERMUT
  832. "=PERMUT(6,6)": "720",
  833. "=PERMUT(7,6)": "5040",
  834. "=PERMUT(10,6)": "151200",
  835. // PERMUTATIONA
  836. "=PERMUTATIONA(6,6)": "46656",
  837. "=PERMUTATIONA(7,6)": "117649",
  838. // QUARTILE
  839. "=QUARTILE(A1:A4,2)": "1.5",
  840. // QUARTILE.INC
  841. "=QUARTILE.INC(A1:A4,0)": "0",
  842. // SKEW
  843. "=SKEW(1,2,3,4,3)": "-0.404796008910937",
  844. "=SKEW(A1:B2)": "0",
  845. "=SKEW(A1:D3)": "0",
  846. // SMALL
  847. "=SMALL(A1:A5,1)": "0",
  848. "=SMALL(A1:B5,2)": "1",
  849. "=SMALL(A1,1)": "1",
  850. "=SMALL(A1:F2,1)": "1",
  851. // VARP
  852. "=VARP(A1:A5)": "1.25",
  853. // VAR.P
  854. "=VAR.P(A1:A5)": "1.25",
  855. // Information Functions
  856. // ISBLANK
  857. "=ISBLANK(A1)": "FALSE",
  858. "=ISBLANK(A5)": "TRUE",
  859. // ISERR
  860. "=ISERR(A1)": "FALSE",
  861. "=ISERR(NA())": "FALSE",
  862. "=ISERR(POWER(0,-1)))": "TRUE",
  863. // ISERROR
  864. "=ISERROR(A1)": "FALSE",
  865. "=ISERROR(NA())": "TRUE",
  866. // ISEVEN
  867. "=ISEVEN(A1)": "FALSE",
  868. "=ISEVEN(A2)": "TRUE",
  869. // ISNA
  870. "=ISNA(A1)": "FALSE",
  871. "=ISNA(NA())": "TRUE",
  872. // ISNONTEXT
  873. "=ISNONTEXT(A1)": "FALSE",
  874. "=ISNONTEXT(A5)": "TRUE",
  875. `=ISNONTEXT("Excelize")`: "FALSE",
  876. "=ISNONTEXT(NA())": "TRUE",
  877. // ISNUMBER
  878. "=ISNUMBER(A1)": "TRUE",
  879. "=ISNUMBER(D1)": "FALSE",
  880. // ISODD
  881. "=ISODD(A1)": "TRUE",
  882. "=ISODD(A2)": "FALSE",
  883. // ISTEXT
  884. "=ISTEXT(D1)": "TRUE",
  885. "=ISTEXT(A1)": "FALSE",
  886. // N
  887. "=N(10)": "10",
  888. "=N(\"10\")": "10",
  889. "=N(\"x\")": "0",
  890. "=N(TRUE)": "1",
  891. "=N(FALSE)": "0",
  892. // SHEET
  893. "=SHEET()": "1",
  894. // T
  895. "=T(\"text\")": "text",
  896. "=T(N(10))": "",
  897. // Logical Functions
  898. // AND
  899. "=AND(0)": "FALSE",
  900. "=AND(1)": "TRUE",
  901. "=AND(1,0)": "FALSE",
  902. "=AND(0,1)": "FALSE",
  903. "=AND(1=1)": "TRUE",
  904. "=AND(1<2)": "TRUE",
  905. "=AND(1>2,2<3,2>0,3>1)": "FALSE",
  906. "=AND(1=1),1=1": "TRUE",
  907. // FALSE
  908. "=FALSE()": "FALSE",
  909. // IFERROR
  910. "=IFERROR(1/2,0)": "0.5",
  911. "=IFERROR(ISERROR(),0)": "0",
  912. "=IFERROR(1/0,0)": "0",
  913. // NOT
  914. "=NOT(FALSE())": "TRUE",
  915. "=NOT(\"false\")": "TRUE",
  916. "=NOT(\"true\")": "FALSE",
  917. "=NOT(ISBLANK(B1))": "TRUE",
  918. // OR
  919. "=OR(1)": "TRUE",
  920. "=OR(0)": "FALSE",
  921. "=OR(1=2,2=2)": "TRUE",
  922. "=OR(1=2,2=3)": "FALSE",
  923. // TRUE
  924. "=TRUE()": "TRUE",
  925. // Date and Time Functions
  926. // DATE
  927. "=DATE(2020,10,21)": "2020-10-21 00:00:00 +0000 UTC",
  928. "=DATE(1900,1,1)": "1899-12-31 00:00:00 +0000 UTC",
  929. // DATEDIF
  930. "=DATEDIF(43101,43101,\"D\")": "0",
  931. "=DATEDIF(43101,43891,\"d\")": "790",
  932. "=DATEDIF(43101,43891,\"Y\")": "2",
  933. "=DATEDIF(42156,44242,\"y\")": "5",
  934. "=DATEDIF(43101,43891,\"M\")": "26",
  935. "=DATEDIF(42171,44242,\"m\")": "67",
  936. "=DATEDIF(42156,44454,\"MD\")": "14",
  937. "=DATEDIF(42171,44242,\"md\")": "30",
  938. "=DATEDIF(43101,43891,\"YM\")": "2",
  939. "=DATEDIF(42171,44242,\"ym\")": "7",
  940. "=DATEDIF(43101,43891,\"YD\")": "59",
  941. "=DATEDIF(36526,73110,\"YD\")": "60",
  942. "=DATEDIF(42171,44242,\"yd\")": "244",
  943. // Text Functions
  944. // CHAR
  945. "=CHAR(65)": "A",
  946. "=CHAR(97)": "a",
  947. "=CHAR(63)": "?",
  948. "=CHAR(51)": "3",
  949. // CLEAN
  950. "=CLEAN(\"\u0009clean text\")": "clean text",
  951. "=CLEAN(0)": "0",
  952. // CODE
  953. "=CODE(\"Alpha\")": "65",
  954. "=CODE(\"alpha\")": "97",
  955. "=CODE(\"?\")": "63",
  956. "=CODE(\"3\")": "51",
  957. "=CODE(\"\")": "0",
  958. // CONCAT
  959. "=CONCAT(TRUE(),1,FALSE(),\"0\",INT(2))": "TRUE1FALSE02",
  960. // CONCATENATE
  961. "=CONCATENATE(TRUE(),1,FALSE(),\"0\",INT(2))": "TRUE1FALSE02",
  962. // EXACT
  963. "=EXACT(1,\"1\")": "TRUE",
  964. "=EXACT(1,1)": "TRUE",
  965. "=EXACT(\"A\",\"a\")": "FALSE",
  966. // FIXED
  967. "=FIXED(5123.591)": "5,123.591",
  968. "=FIXED(5123.591,1)": "5,123.6",
  969. "=FIXED(5123.591,0)": "5,124",
  970. "=FIXED(5123.591,-1)": "5,120",
  971. "=FIXED(5123.591,-2)": "5,100",
  972. "=FIXED(5123.591,-3,TRUE)": "5000",
  973. "=FIXED(5123.591,-5)": "0",
  974. "=FIXED(-77262.23973,-5)": "-100,000",
  975. // FIND
  976. "=FIND(\"T\",\"Original Text\")": "10",
  977. "=FIND(\"t\",\"Original Text\")": "13",
  978. "=FIND(\"i\",\"Original Text\")": "3",
  979. "=FIND(\"i\",\"Original Text\",4)": "5",
  980. "=FIND(\"\",\"Original Text\")": "1",
  981. "=FIND(\"\",\"Original Text\",2)": "2",
  982. // FINDB
  983. "=FINDB(\"T\",\"Original Text\")": "10",
  984. "=FINDB(\"t\",\"Original Text\")": "13",
  985. "=FINDB(\"i\",\"Original Text\")": "3",
  986. "=FINDB(\"i\",\"Original Text\",4)": "5",
  987. "=FINDB(\"\",\"Original Text\")": "1",
  988. "=FINDB(\"\",\"Original Text\",2)": "2",
  989. // LEFT
  990. "=LEFT(\"Original Text\")": "O",
  991. "=LEFT(\"Original Text\",4)": "Orig",
  992. "=LEFT(\"Original Text\",0)": "",
  993. "=LEFT(\"Original Text\",13)": "Original Text",
  994. "=LEFT(\"Original Text\",20)": "Original Text",
  995. // LEFTB
  996. "=LEFTB(\"Original Text\")": "O",
  997. "=LEFTB(\"Original Text\",4)": "Orig",
  998. "=LEFTB(\"Original Text\",0)": "",
  999. "=LEFTB(\"Original Text\",13)": "Original Text",
  1000. "=LEFTB(\"Original Text\",20)": "Original Text",
  1001. // LEN
  1002. "=LEN(\"\")": "0",
  1003. "=LEN(D1)": "5",
  1004. // LENB
  1005. "=LENB(\"\")": "0",
  1006. "=LENB(D1)": "5",
  1007. // LOWER
  1008. "=LOWER(\"test\")": "test",
  1009. "=LOWER(\"TEST\")": "test",
  1010. "=LOWER(\"Test\")": "test",
  1011. "=LOWER(\"TEST 123\")": "test 123",
  1012. // MID
  1013. "=MID(\"Original Text\",7,1)": "a",
  1014. "=MID(\"Original Text\",4,7)": "ginal T",
  1015. "=MID(\"255 years\",3,1)": "5",
  1016. "=MID(\"text\",3,6)": "xt",
  1017. "=MID(\"text\",6,0)": "",
  1018. // MIDB
  1019. "=MIDB(\"Original Text\",7,1)": "a",
  1020. "=MIDB(\"Original Text\",4,7)": "ginal T",
  1021. "=MIDB(\"255 years\",3,1)": "5",
  1022. "=MIDB(\"text\",3,6)": "xt",
  1023. "=MIDB(\"text\",6,0)": "",
  1024. // PROPER
  1025. "=PROPER(\"this is a test sentence\")": "This Is A Test Sentence",
  1026. "=PROPER(\"THIS IS A TEST SENTENCE\")": "This Is A Test Sentence",
  1027. "=PROPER(\"123tEST teXT\")": "123Test Text",
  1028. "=PROPER(\"Mr. SMITH's address\")": "Mr. Smith'S Address",
  1029. // REPLACE
  1030. "=REPLACE(\"test string\",7,3,\"X\")": "test sXng",
  1031. "=REPLACE(\"second test string\",8,4,\"XXX\")": "second XXX string",
  1032. "=REPLACE(\"text\",5,0,\" and char\")": "text and char",
  1033. "=REPLACE(\"text\",1,20,\"char and \")": "char and ",
  1034. // REPLACEB
  1035. "=REPLACEB(\"test string\",7,3,\"X\")": "test sXng",
  1036. "=REPLACEB(\"second test string\",8,4,\"XXX\")": "second XXX string",
  1037. "=REPLACEB(\"text\",5,0,\" and char\")": "text and char",
  1038. "=REPLACEB(\"text\",1,20,\"char and \")": "char and ",
  1039. // REPT
  1040. "=REPT(\"*\",0)": "",
  1041. "=REPT(\"*\",1)": "*",
  1042. "=REPT(\"**\",2)": "****",
  1043. // RIGHT
  1044. "=RIGHT(\"Original Text\")": "t",
  1045. "=RIGHT(\"Original Text\",4)": "Text",
  1046. "=RIGHT(\"Original Text\",0)": "",
  1047. "=RIGHT(\"Original Text\",13)": "Original Text",
  1048. "=RIGHT(\"Original Text\",20)": "Original Text",
  1049. // RIGHTB
  1050. "=RIGHTB(\"Original Text\")": "t",
  1051. "=RIGHTB(\"Original Text\",4)": "Text",
  1052. "=RIGHTB(\"Original Text\",0)": "",
  1053. "=RIGHTB(\"Original Text\",13)": "Original Text",
  1054. "=RIGHTB(\"Original Text\",20)": "Original Text",
  1055. // SUBSTITUTE
  1056. "=SUBSTITUTE(\"abab\",\"a\",\"X\")": "XbXb",
  1057. "=SUBSTITUTE(\"abab\",\"a\",\"X\",2)": "abXb",
  1058. "=SUBSTITUTE(\"abab\",\"x\",\"X\",2)": "abab",
  1059. "=SUBSTITUTE(\"John is 5 years old\",\"John\",\"Jack\")": "Jack is 5 years old",
  1060. "=SUBSTITUTE(\"John is 5 years old\",\"5\",\"6\")": "John is 6 years old",
  1061. // TRIM
  1062. "=TRIM(\" trim text \")": "trim text",
  1063. "=TRIM(0)": "0",
  1064. // UNICHAR
  1065. "=UNICHAR(65)": "A",
  1066. "=UNICHAR(97)": "a",
  1067. "=UNICHAR(63)": "?",
  1068. "=UNICHAR(51)": "3",
  1069. // UNICODE
  1070. "=UNICODE(\"Alpha\")": "65",
  1071. "=UNICODE(\"alpha\")": "97",
  1072. "=UNICODE(\"?\")": "63",
  1073. "=UNICODE(\"3\")": "51",
  1074. // UPPER
  1075. "=UPPER(\"test\")": "TEST",
  1076. "=UPPER(\"TEST\")": "TEST",
  1077. "=UPPER(\"Test\")": "TEST",
  1078. "=UPPER(\"TEST 123\")": "TEST 123",
  1079. // Conditional Functions
  1080. // IF
  1081. "=IF(1=1)": "TRUE",
  1082. "=IF(1<>1)": "FALSE",
  1083. "=IF(5<0, \"negative\", \"positive\")": "positive",
  1084. "=IF(-2<0, \"negative\", \"positive\")": "negative",
  1085. `=IF(1=1, "equal", "notequal")`: "equal",
  1086. `=IF(1<>1, "equal", "notequal")`: "notequal",
  1087. `=IF("A"="A", "equal", "notequal")`: "equal",
  1088. `=IF("A"<>"A", "equal", "notequal")`: "notequal",
  1089. // Excel Lookup and Reference Functions
  1090. // CHOOSE
  1091. "=CHOOSE(4,\"red\",\"blue\",\"green\",\"brown\")": "brown",
  1092. "=CHOOSE(1,\"red\",\"blue\",\"green\",\"brown\")": "red",
  1093. "=SUM(CHOOSE(A2,A1,B1:B2,A1:A3,A1:A4))": "9",
  1094. // COLUMN
  1095. "=COLUMN()": "3",
  1096. "=COLUMN(Sheet1!A1)": "1",
  1097. "=COLUMN(Sheet1!A1:B1:C1)": "1",
  1098. "=COLUMN(Sheet1!F1:G1)": "6",
  1099. "=COLUMN(H1)": "8",
  1100. // COLUMNS
  1101. "=COLUMNS(B1)": "1",
  1102. "=COLUMNS(1:1)": "16384",
  1103. "=COLUMNS(Sheet1!1:1)": "16384",
  1104. "=COLUMNS(B1:E5)": "4",
  1105. "=COLUMNS(Sheet1!E5:H7:B1)": "7",
  1106. "=COLUMNS(E5:H7:B1:C1:Z1:C1:B1)": "25",
  1107. "=COLUMNS(E5:B1)": "4",
  1108. "=COLUMNS(EM38:HZ81)": "92",
  1109. // HLOOKUP
  1110. "=HLOOKUP(D2,D2:D8,1,FALSE)": "Jan",
  1111. "=HLOOKUP(F3,F3:F8,3,FALSE)": "34440",
  1112. "=HLOOKUP(INT(F3),F3:F8,3,FALSE)": "34440",
  1113. "=HLOOKUP(MUNIT(1),MUNIT(1),1,FALSE)": "1",
  1114. // VLOOKUP
  1115. "=VLOOKUP(D2,D:D,1,FALSE)": "Jan",
  1116. "=VLOOKUP(D2,D1:D10,1)": "Jan",
  1117. "=VLOOKUP(D2,D1:D11,1)": "Feb",
  1118. "=VLOOKUP(D2,D1:D10,1,FALSE)": "Jan",
  1119. "=VLOOKUP(INT(36693),F2:F2,1,FALSE)": "36693",
  1120. "=VLOOKUP(INT(F2),F3:F9,1)": "32080",
  1121. "=VLOOKUP(INT(F2),F3:F9,1,TRUE)": "32080",
  1122. "=VLOOKUP(MUNIT(3),MUNIT(3),1)": "0",
  1123. "=VLOOKUP(A1,A3:B5,1)": "0",
  1124. "=VLOOKUP(MUNIT(1),MUNIT(1),1,FALSE)": "1",
  1125. // LOOKUP
  1126. "=LOOKUP(F8,F8:F9,F8:F9)": "32080",
  1127. "=LOOKUP(F8,F8:F9,D8:D9)": "Feb",
  1128. "=LOOKUP(1,MUNIT(1),MUNIT(1))": "1",
  1129. // ROW
  1130. "=ROW()": "1",
  1131. "=ROW(Sheet1!A1)": "1",
  1132. "=ROW(Sheet1!A1:B2:C3)": "1",
  1133. "=ROW(Sheet1!F5:G6)": "5",
  1134. "=ROW(A8)": "8",
  1135. // ROWS
  1136. "=ROWS(B1)": "1",
  1137. "=ROWS(B:B)": "1048576",
  1138. "=ROWS(Sheet1!B:B)": "1048576",
  1139. "=ROWS(B1:E5)": "5",
  1140. "=ROWS(Sheet1!E5:H7:B1)": "7",
  1141. "=ROWS(E5:H8:B2:C3:Z26:C3:B2)": "25",
  1142. "=ROWS(E5:B1)": "5",
  1143. "=ROWS(EM38:HZ81)": "44",
  1144. // Web Functions
  1145. // ENCODEURL
  1146. "=ENCODEURL(\"https://xuri.me/excelize/en/?q=Save As\")": "https%3A%2F%2Fxuri.me%2Fexcelize%2Fen%2F%3Fq%3DSave%20As",
  1147. // Financial Functions
  1148. // CUMIPMT
  1149. "=CUMIPMT(0.05/12,60,50000,1,12,0)": "-2294.97753732664",
  1150. "=CUMIPMT(0.05/12,60,50000,13,24,0)": "-1833.1000665738893",
  1151. // CUMPRINC
  1152. "=CUMPRINC(0.05/12,60,50000,1,12,0)": "-9027.762649079885",
  1153. "=CUMPRINC(0.05/12,60,50000,13,24,0)": "-9489.640119832635",
  1154. // DB
  1155. "=DB(0,1000,5,1)": "0",
  1156. "=DB(10000,1000,5,1)": "3690",
  1157. "=DB(10000,1000,5,2)": "2328.39",
  1158. "=DB(10000,1000,5,1,6)": "1845",
  1159. "=DB(10000,1000,5,6,6)": "238.52712458788187",
  1160. // DDB
  1161. "=DDB(0,1000,5,1)": "0",
  1162. "=DDB(10000,1000,5,1)": "4000",
  1163. "=DDB(10000,1000,5,2)": "2400",
  1164. "=DDB(10000,1000,5,3)": "1440",
  1165. "=DDB(10000,1000,5,4)": "864",
  1166. "=DDB(10000,1000,5,5)": "296",
  1167. // DOLLARDE
  1168. "=DOLLARDE(1.01,16)": "1.0625",
  1169. // DOLLARFR
  1170. "=DOLLARFR(1.0625,16)": "1.01",
  1171. // EFFECT
  1172. "=EFFECT(0.1,4)": "0.103812890625",
  1173. "=EFFECT(0.025,2)": "0.02515625",
  1174. // FV
  1175. "=FV(0.05/12,60,-1000)": "68006.08284084337",
  1176. "=FV(0.1/4,16,-2000,0,1)": "39729.46089416617",
  1177. "=FV(0,16,-2000)": "32000",
  1178. // FVSCHEDULE
  1179. "=FVSCHEDULE(10000,A1:A5)": "240000",
  1180. "=FVSCHEDULE(10000,0.5)": "15000",
  1181. // IPMT
  1182. "=IPMT(0.05/12,2,60,50000)": "-205.26988187971995",
  1183. "=IPMT(0.035/4,2,8,0,5000,1)": "5.257455237829077",
  1184. // ISPMT
  1185. "=ISPMT(0.05/12,1,60,50000)": "-204.8611111111111",
  1186. "=ISPMT(0.05/12,2,60,50000)": "-201.38888888888886",
  1187. "=ISPMT(0.05/12,2,1,50000)": "208.33333333333334",
  1188. // NOMINAL
  1189. "=NOMINAL(0.025,12)": "0.024718035238113",
  1190. // NPER
  1191. "=NPER(0.04,-6000,50000)": "10.338035071507665",
  1192. "=NPER(0,-6000,50000)": "8.333333333333334",
  1193. "=NPER(0.06/4,-2000,60000,30000,1)": "52.794773709274764",
  1194. // NPV
  1195. "=NPV(0.02,-5000,\"\",800)": "-4133.025759323337",
  1196. // PDURATION
  1197. "=PDURATION(0.04,10000,15000)": "10.33803507150765",
  1198. // PMT
  1199. "=PMT(0,8,0,5000,1)": "-625",
  1200. "=PMT(0.035/4,8,0,5000,1)": "-600.8520271804658",
  1201. // PPMT
  1202. "=PPMT(0.05/12,2,60,50000)": "-738.2918003208238",
  1203. "=PPMT(0.035/4,2,8,0,5000,1)": "-606.1094824182949",
  1204. }
  1205. for formula, expected := range mathCalc {
  1206. f := prepareCalcData(cellData)
  1207. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", formula))
  1208. result, err := f.CalcCellValue("Sheet1", "C1")
  1209. assert.NoError(t, err, formula)
  1210. assert.Equal(t, expected, result, formula)
  1211. }
  1212. mathCalcError := map[string]string{
  1213. "=1/0": "#DIV/0!",
  1214. // Engineering Functions
  1215. // BESSELI
  1216. "=BESSELI()": "BESSELI requires 2 numeric arguments",
  1217. "=BESSELI(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1218. "=BESSELI(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1219. // BESSELJ
  1220. "=BESSELJ()": "BESSELJ requires 2 numeric arguments",
  1221. "=BESSELJ(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1222. "=BESSELJ(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1223. // BESSELK
  1224. "=BESSELK()": "BESSELK requires 2 numeric arguments",
  1225. "=BESSELK(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1226. "=BESSELK(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1227. "=BESSELK(-1,0)": "#NUM!",
  1228. "=BESSELK(1,-1)": "#NUM!",
  1229. // BESSELY
  1230. "=BESSELY()": "BESSELY requires 2 numeric arguments",
  1231. "=BESSELY(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1232. "=BESSELY(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1233. "=BESSELY(-1,0)": "#NUM!",
  1234. "=BESSELY(1,-1)": "#NUM!",
  1235. // BIN2DEC
  1236. "=BIN2DEC()": "BIN2DEC requires 1 numeric argument",
  1237. "=BIN2DEC(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1238. // BIN2HEX
  1239. "=BIN2HEX()": "BIN2HEX requires at least 1 argument",
  1240. "=BIN2HEX(1,1,1)": "BIN2HEX allows at most 2 arguments",
  1241. "=BIN2HEX(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1242. "=BIN2HEX(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1243. "=BIN2HEX(12345678901,10)": "#NUM!",
  1244. "=BIN2HEX(1,-1)": "#NUM!",
  1245. "=BIN2HEX(31,1)": "#NUM!",
  1246. // BIN2OCT
  1247. "=BIN2OCT()": "BIN2OCT requires at least 1 argument",
  1248. "=BIN2OCT(1,1,1)": "BIN2OCT allows at most 2 arguments",
  1249. "=BIN2OCT(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1250. "=BIN2OCT(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1251. "=BIN2OCT(-12345678901 ,10)": "#NUM!",
  1252. "=BIN2OCT(1,-1)": "#NUM!",
  1253. "=BIN2OCT(8,1)": "#NUM!",
  1254. // BITAND
  1255. "=BITAND()": "BITAND requires 2 numeric arguments",
  1256. "=BITAND(-1,2)": "#NUM!",
  1257. "=BITAND(2^48,2)": "#NUM!",
  1258. "=BITAND(1,-1)": "#NUM!",
  1259. "=BITAND(\"\",-1)": "#NUM!",
  1260. "=BITAND(1,\"\")": "#NUM!",
  1261. "=BITAND(1,2^48)": "#NUM!",
  1262. // BITLSHIFT
  1263. "=BITLSHIFT()": "BITLSHIFT requires 2 numeric arguments",
  1264. "=BITLSHIFT(-1,2)": "#NUM!",
  1265. "=BITLSHIFT(2^48,2)": "#NUM!",
  1266. "=BITLSHIFT(1,-1)": "#NUM!",
  1267. "=BITLSHIFT(\"\",-1)": "#NUM!",
  1268. "=BITLSHIFT(1,\"\")": "#NUM!",
  1269. "=BITLSHIFT(1,2^48)": "#NUM!",
  1270. // BITOR
  1271. "=BITOR()": "BITOR requires 2 numeric arguments",
  1272. "=BITOR(-1,2)": "#NUM!",
  1273. "=BITOR(2^48,2)": "#NUM!",
  1274. "=BITOR(1,-1)": "#NUM!",
  1275. "=BITOR(\"\",-1)": "#NUM!",
  1276. "=BITOR(1,\"\")": "#NUM!",
  1277. "=BITOR(1,2^48)": "#NUM!",
  1278. // BITRSHIFT
  1279. "=BITRSHIFT()": "BITRSHIFT requires 2 numeric arguments",
  1280. "=BITRSHIFT(-1,2)": "#NUM!",
  1281. "=BITRSHIFT(2^48,2)": "#NUM!",
  1282. "=BITRSHIFT(1,-1)": "#NUM!",
  1283. "=BITRSHIFT(\"\",-1)": "#NUM!",
  1284. "=BITRSHIFT(1,\"\")": "#NUM!",
  1285. "=BITRSHIFT(1,2^48)": "#NUM!",
  1286. // BITXOR
  1287. "=BITXOR()": "BITXOR requires 2 numeric arguments",
  1288. "=BITXOR(-1,2)": "#NUM!",
  1289. "=BITXOR(2^48,2)": "#NUM!",
  1290. "=BITXOR(1,-1)": "#NUM!",
  1291. "=BITXOR(\"\",-1)": "#NUM!",
  1292. "=BITXOR(1,\"\")": "#NUM!",
  1293. "=BITXOR(1,2^48)": "#NUM!",
  1294. // COMPLEX
  1295. "=COMPLEX()": "COMPLEX requires at least 2 arguments",
  1296. "=COMPLEX(10,-5,\"\")": "#VALUE!",
  1297. "=COMPLEX(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1298. "=COMPLEX(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1299. "=COMPLEX(10,-5,\"i\",0)": "COMPLEX allows at most 3 arguments",
  1300. // DEC2BIN
  1301. "=DEC2BIN()": "DEC2BIN requires at least 1 argument",
  1302. "=DEC2BIN(1,1,1)": "DEC2BIN allows at most 2 arguments",
  1303. "=DEC2BIN(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1304. "=DEC2BIN(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1305. "=DEC2BIN(-513,10)": "#NUM!",
  1306. "=DEC2BIN(1,-1)": "#NUM!",
  1307. "=DEC2BIN(2,1)": "#NUM!",
  1308. // DEC2HEX
  1309. "=DEC2HEX()": "DEC2HEX requires at least 1 argument",
  1310. "=DEC2HEX(1,1,1)": "DEC2HEX allows at most 2 arguments",
  1311. "=DEC2HEX(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1312. "=DEC2HEX(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1313. "=DEC2HEX(-549755813888,10)": "#NUM!",
  1314. "=DEC2HEX(1,-1)": "#NUM!",
  1315. "=DEC2HEX(31,1)": "#NUM!",
  1316. // DEC2OCT
  1317. "=DEC2OCT()": "DEC2OCT requires at least 1 argument",
  1318. "=DEC2OCT(1,1,1)": "DEC2OCT allows at most 2 arguments",
  1319. "=DEC2OCT(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1320. "=DEC2OCT(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1321. "=DEC2OCT(-536870912 ,10)": "#NUM!",
  1322. "=DEC2OCT(1,-1)": "#NUM!",
  1323. "=DEC2OCT(8,1)": "#NUM!",
  1324. // HEX2BIN
  1325. "=HEX2BIN()": "HEX2BIN requires at least 1 argument",
  1326. "=HEX2BIN(1,1,1)": "HEX2BIN allows at most 2 arguments",
  1327. "=HEX2BIN(\"X\",1)": "strconv.ParseInt: parsing \"X\": invalid syntax",
  1328. "=HEX2BIN(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1329. "=HEX2BIN(-513,10)": "strconv.ParseInt: parsing \"-\": invalid syntax",
  1330. "=HEX2BIN(1,-1)": "#NUM!",
  1331. "=HEX2BIN(2,1)": "#NUM!",
  1332. // HEX2DEC
  1333. "=HEX2DEC()": "HEX2DEC requires 1 numeric argument",
  1334. "=HEX2DEC(\"X\")": "strconv.ParseInt: parsing \"X\": invalid syntax",
  1335. // HEX2OCT
  1336. "=HEX2OCT()": "HEX2OCT requires at least 1 argument",
  1337. "=HEX2OCT(1,1,1)": "HEX2OCT allows at most 2 arguments",
  1338. "=HEX2OCT(\"X\",1)": "strconv.ParseInt: parsing \"X\": invalid syntax",
  1339. "=HEX2OCT(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1340. "=HEX2OCT(-513,10)": "strconv.ParseInt: parsing \"-\": invalid syntax",
  1341. "=HEX2OCT(1,-1)": "#NUM!",
  1342. // IMABS
  1343. "=IMABS()": "IMABS requires 1 argument",
  1344. "=IMABS(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1345. // IMAGINARY
  1346. "=IMAGINARY()": "IMAGINARY requires 1 argument",
  1347. "=IMAGINARY(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1348. // IMARGUMENT
  1349. "=IMARGUMENT()": "IMARGUMENT requires 1 argument",
  1350. "=IMARGUMENT(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1351. // IMCONJUGATE
  1352. "=IMCONJUGATE()": "IMCONJUGATE requires 1 argument",
  1353. "=IMCONJUGATE(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1354. // IMCOS
  1355. "=IMCOS()": "IMCOS requires 1 argument",
  1356. "=IMCOS(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1357. // IMCOSH
  1358. "=IMCOSH()": "IMCOSH requires 1 argument",
  1359. "=IMCOSH(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1360. // IMCOT
  1361. "=IMCOT()": "IMCOT requires 1 argument",
  1362. "=IMCOT(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1363. // IMCSC
  1364. "=IMCSC()": "IMCSC requires 1 argument",
  1365. "=IMCSC(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1366. "=IMCSC(0)": "#NUM!",
  1367. // IMCSCH
  1368. "=IMCSCH()": "IMCSCH requires 1 argument",
  1369. "=IMCSCH(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1370. "=IMCSCH(0)": "#NUM!",
  1371. // IMDIV
  1372. "=IMDIV()": "IMDIV requires 2 arguments",
  1373. "=IMDIV(0,\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1374. "=IMDIV(\"\",0)": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1375. "=IMDIV(1,0)": "#NUM!",
  1376. // IMEXP
  1377. "=IMEXP()": "IMEXP requires 1 argument",
  1378. "=IMEXP(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1379. // IMLN
  1380. "=IMLN()": "IMLN requires 1 argument",
  1381. "=IMLN(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1382. "=IMLN(0)": "#NUM!",
  1383. // IMLOG10
  1384. "=IMLOG10()": "IMLOG10 requires 1 argument",
  1385. "=IMLOG10(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1386. "=IMLOG10(0)": "#NUM!",
  1387. // IMLOG2
  1388. "=IMLOG2()": "IMLOG2 requires 1 argument",
  1389. "=IMLOG2(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1390. "=IMLOG2(0)": "#NUM!",
  1391. // IMPOWER
  1392. "=IMPOWER()": "IMPOWER requires 2 arguments",
  1393. "=IMPOWER(0,\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1394. "=IMPOWER(\"\",0)": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1395. "=IMPOWER(0,0)": "#NUM!",
  1396. "=IMPOWER(0,-1)": "#NUM!",
  1397. // IMPRODUCT
  1398. "=IMPRODUCT(\"x\")": "strconv.ParseComplex: parsing \"x\": invalid syntax",
  1399. "=IMPRODUCT(A1:D1)": "strconv.ParseComplex: parsing \"Month\": invalid syntax",
  1400. // IMREAL
  1401. "=IMREAL()": "IMREAL requires 1 argument",
  1402. "=IMREAL(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1403. // IMSEC
  1404. "=IMSEC()": "IMSEC requires 1 argument",
  1405. "=IMSEC(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1406. // IMSECH
  1407. "=IMSECH()": "IMSECH requires 1 argument",
  1408. "=IMSECH(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1409. // IMSIN
  1410. "=IMSIN()": "IMSIN requires 1 argument",
  1411. "=IMSIN(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1412. // IMSINH
  1413. "=IMSINH()": "IMSINH requires 1 argument",
  1414. "=IMSINH(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1415. // IMSQRT
  1416. "=IMSQRT()": "IMSQRT requires 1 argument",
  1417. "=IMSQRT(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1418. // IMSUB
  1419. "=IMSUB()": "IMSUB requires 2 arguments",
  1420. "=IMSUB(0,\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1421. "=IMSUB(\"\",0)": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1422. // IMSUM
  1423. "=IMSUM()": "IMSUM requires at least 1 argument",
  1424. "=IMSUM(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1425. // IMTAN
  1426. "=IMTAN()": "IMTAN requires 1 argument",
  1427. "=IMTAN(\"\")": "strconv.ParseComplex: parsing \"\": invalid syntax",
  1428. // OCT2BIN
  1429. "=OCT2BIN()": "OCT2BIN requires at least 1 argument",
  1430. "=OCT2BIN(1,1,1)": "OCT2BIN allows at most 2 arguments",
  1431. "=OCT2BIN(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1432. "=OCT2BIN(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1433. "=OCT2BIN(-536870912 ,10)": "#NUM!",
  1434. "=OCT2BIN(1,-1)": "#NUM!",
  1435. // OCT2DEC
  1436. "=OCT2DEC()": "OCT2DEC requires 1 numeric argument",
  1437. "=OCT2DEC(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1438. // OCT2HEX
  1439. "=OCT2HEX()": "OCT2HEX requires at least 1 argument",
  1440. "=OCT2HEX(1,1,1)": "OCT2HEX allows at most 2 arguments",
  1441. "=OCT2HEX(\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1442. "=OCT2HEX(1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1443. "=OCT2HEX(-536870912 ,10)": "#NUM!",
  1444. "=OCT2HEX(1,-1)": "#NUM!",
  1445. // Math and Trigonometric Functions
  1446. // ABS
  1447. "=ABS()": "ABS requires 1 numeric argument",
  1448. `=ABS("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1449. "=ABS(~)": `invalid column name "~"`,
  1450. // ACOS
  1451. "=ACOS()": "ACOS requires 1 numeric argument",
  1452. `=ACOS("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1453. "=ACOS(ACOS(0))": "#NUM!",
  1454. // ACOSH
  1455. "=ACOSH()": "ACOSH requires 1 numeric argument",
  1456. `=ACOSH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1457. // _xlfn.ACOT
  1458. "=_xlfn.ACOT()": "ACOT requires 1 numeric argument",
  1459. `=_xlfn.ACOT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1460. // _xlfn.ACOTH
  1461. "=_xlfn.ACOTH()": "ACOTH requires 1 numeric argument",
  1462. `=_xlfn.ACOTH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1463. "=_xlfn.ACOTH(_xlfn.ACOTH(2))": "#NUM!",
  1464. // _xlfn.ARABIC
  1465. "=_xlfn.ARABIC()": "ARABIC requires 1 numeric argument",
  1466. "=_xlfn.ARABIC(\"" + strings.Repeat("I", 256) + "\")": "#VALUE!",
  1467. // ASIN
  1468. "=ASIN()": "ASIN requires 1 numeric argument",
  1469. `=ASIN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1470. // ASINH
  1471. "=ASINH()": "ASINH requires 1 numeric argument",
  1472. `=ASINH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1473. // ATAN
  1474. "=ATAN()": "ATAN requires 1 numeric argument",
  1475. `=ATAN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1476. // ATANH
  1477. "=ATANH()": "ATANH requires 1 numeric argument",
  1478. `=ATANH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1479. // ATAN2
  1480. "=ATAN2()": "ATAN2 requires 2 numeric arguments",
  1481. `=ATAN2("X",0)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1482. `=ATAN2(0,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1483. // BASE
  1484. "=BASE()": "BASE requires at least 2 arguments",
  1485. "=BASE(1,2,3,4)": "BASE allows at most 3 arguments",
  1486. "=BASE(1,1)": "radix must be an integer >= 2 and <= 36",
  1487. `=BASE("X",2)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1488. `=BASE(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1489. `=BASE(1,2,"X")`: "strconv.Atoi: parsing \"X\": invalid syntax",
  1490. // CEILING
  1491. "=CEILING()": "CEILING requires at least 1 argument",
  1492. "=CEILING(1,2,3)": "CEILING allows at most 2 arguments",
  1493. "=CEILING(1,-1)": "negative sig to CEILING invalid",
  1494. `=CEILING("X",0)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1495. `=CEILING(0,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1496. // _xlfn.CEILING.MATH
  1497. "=_xlfn.CEILING.MATH()": "CEILING.MATH requires at least 1 argument",
  1498. "=_xlfn.CEILING.MATH(1,2,3,4)": "CEILING.MATH allows at most 3 arguments",
  1499. `=_xlfn.CEILING.MATH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1500. `=_xlfn.CEILING.MATH(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1501. `=_xlfn.CEILING.MATH(1,2,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1502. // _xlfn.CEILING.PRECISE
  1503. "=_xlfn.CEILING.PRECISE()": "CEILING.PRECISE requires at least 1 argument",
  1504. "=_xlfn.CEILING.PRECISE(1,2,3)": "CEILING.PRECISE allows at most 2 arguments",
  1505. `=_xlfn.CEILING.PRECISE("X",2)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1506. `=_xlfn.CEILING.PRECISE(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1507. // COMBIN
  1508. "=COMBIN()": "COMBIN requires 2 argument",
  1509. "=COMBIN(-1,1)": "COMBIN requires number >= number_chosen",
  1510. `=COMBIN("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1511. `=COMBIN(-1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1512. // _xlfn.COMBINA
  1513. "=_xlfn.COMBINA()": "COMBINA requires 2 argument",
  1514. "=_xlfn.COMBINA(-1,1)": "COMBINA requires number > number_chosen",
  1515. "=_xlfn.COMBINA(-1,-1)": "COMBIN requires number >= number_chosen",
  1516. `=_xlfn.COMBINA("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1517. `=_xlfn.COMBINA(-1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1518. // COS
  1519. "=COS()": "COS requires 1 numeric argument",
  1520. `=COS("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1521. // COSH
  1522. "=COSH()": "COSH requires 1 numeric argument",
  1523. `=COSH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1524. // _xlfn.COT
  1525. "=COT()": "COT requires 1 numeric argument",
  1526. `=COT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1527. "=COT(0)": "#DIV/0!",
  1528. // _xlfn.COTH
  1529. "=COTH()": "COTH requires 1 numeric argument",
  1530. `=COTH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1531. "=COTH(0)": "#DIV/0!",
  1532. // _xlfn.CSC
  1533. "=_xlfn.CSC()": "CSC requires 1 numeric argument",
  1534. `=_xlfn.CSC("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1535. "=_xlfn.CSC(0)": "#DIV/0!",
  1536. // _xlfn.CSCH
  1537. "=_xlfn.CSCH()": "CSCH requires 1 numeric argument",
  1538. `=_xlfn.CSCH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1539. "=_xlfn.CSCH(0)": "#DIV/0!",
  1540. // _xlfn.DECIMAL
  1541. "=_xlfn.DECIMAL()": "DECIMAL requires 2 numeric arguments",
  1542. `=_xlfn.DECIMAL("X", 2)`: "strconv.ParseInt: parsing \"X\": invalid syntax",
  1543. `=_xlfn.DECIMAL(2000, "X")`: "strconv.Atoi: parsing \"X\": invalid syntax",
  1544. // DEGREES
  1545. "=DEGREES()": "DEGREES requires 1 numeric argument",
  1546. `=DEGREES("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1547. "=DEGREES(0)": "#DIV/0!",
  1548. // EVEN
  1549. "=EVEN()": "EVEN requires 1 numeric argument",
  1550. `=EVEN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1551. // EXP
  1552. "=EXP()": "EXP requires 1 numeric argument",
  1553. `=EXP("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1554. // FACT
  1555. "=FACT()": "FACT requires 1 numeric argument",
  1556. `=FACT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1557. "=FACT(-1)": "#NUM!",
  1558. // FACTDOUBLE
  1559. "=FACTDOUBLE()": "FACTDOUBLE requires 1 numeric argument",
  1560. `=FACTDOUBLE("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1561. "=FACTDOUBLE(-1)": "#NUM!",
  1562. // FLOOR
  1563. "=FLOOR()": "FLOOR requires 2 numeric arguments",
  1564. `=FLOOR("X",-1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1565. `=FLOOR(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1566. "=FLOOR(1,-1)": "invalid arguments to FLOOR",
  1567. // _xlfn.FLOOR.MATH
  1568. "=_xlfn.FLOOR.MATH()": "FLOOR.MATH requires at least 1 argument",
  1569. "=_xlfn.FLOOR.MATH(1,2,3,4)": "FLOOR.MATH allows at most 3 arguments",
  1570. `=_xlfn.FLOOR.MATH("X",2,3)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1571. `=_xlfn.FLOOR.MATH(1,"X",3)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1572. `=_xlfn.FLOOR.MATH(1,2,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1573. // _xlfn.FLOOR.PRECISE
  1574. "=_xlfn.FLOOR.PRECISE()": "FLOOR.PRECISE requires at least 1 argument",
  1575. "=_xlfn.FLOOR.PRECISE(1,2,3)": "FLOOR.PRECISE allows at most 2 arguments",
  1576. `=_xlfn.FLOOR.PRECISE("X",2)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1577. `=_xlfn.FLOOR.PRECISE(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1578. // GCD
  1579. "=GCD()": "GCD requires at least 1 argument",
  1580. "=GCD(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1581. "=GCD(-1)": "GCD only accepts positive arguments",
  1582. "=GCD(1,-1)": "GCD only accepts positive arguments",
  1583. `=GCD("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1584. // INT
  1585. "=INT()": "INT requires 1 numeric argument",
  1586. `=INT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1587. // ISO.CEILING
  1588. "=ISO.CEILING()": "ISO.CEILING requires at least 1 argument",
  1589. "=ISO.CEILING(1,2,3)": "ISO.CEILING allows at most 2 arguments",
  1590. `=ISO.CEILING("X",2)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1591. `=ISO.CEILING(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1592. // LCM
  1593. "=LCM()": "LCM requires at least 1 argument",
  1594. "=LCM(-1)": "LCM only accepts positive arguments",
  1595. "=LCM(1,-1)": "LCM only accepts positive arguments",
  1596. `=LCM("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1597. // LN
  1598. "=LN()": "LN requires 1 numeric argument",
  1599. `=LN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1600. // LOG
  1601. "=LOG()": "LOG requires at least 1 argument",
  1602. "=LOG(1,2,3)": "LOG allows at most 2 arguments",
  1603. `=LOG("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1604. `=LOG(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1605. "=LOG(0,0)": "#DIV/0!",
  1606. "=LOG(1,0)": "#DIV/0!",
  1607. "=LOG(1,1)": "#DIV/0!",
  1608. // LOG10
  1609. "=LOG10()": "LOG10 requires 1 numeric argument",
  1610. `=LOG10("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1611. // MDETERM
  1612. "MDETERM()": "MDETERM requires at least 1 argument",
  1613. // MOD
  1614. "=MOD()": "MOD requires 2 numeric arguments",
  1615. "=MOD(6,0)": "MOD divide by zero",
  1616. `=MOD("X",0)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1617. `=MOD(6,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1618. // MROUND
  1619. "=MROUND()": "MROUND requires 2 numeric arguments",
  1620. "=MROUND(1,0)": "#NUM!",
  1621. "=MROUND(1,-1)": "#NUM!",
  1622. `=MROUND("X",0)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1623. `=MROUND(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1624. // MULTINOMIAL
  1625. `=MULTINOMIAL("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1626. // _xlfn.MUNIT
  1627. "=_xlfn.MUNIT()": "MUNIT requires 1 numeric argument",
  1628. `=_xlfn.MUNIT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1629. "=_xlfn.MUNIT(-1)": "",
  1630. // ODD
  1631. "=ODD()": "ODD requires 1 numeric argument",
  1632. `=ODD("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1633. // PI
  1634. "=PI(1)": "PI accepts no arguments",
  1635. // POWER
  1636. `=POWER("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1637. `=POWER(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1638. "=POWER(0,0)": "#NUM!",
  1639. "=POWER(0,-1)": "#DIV/0!",
  1640. "=POWER(1)": "POWER requires 2 numeric arguments",
  1641. // PRODUCT
  1642. `=PRODUCT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1643. // QUOTIENT
  1644. `=QUOTIENT("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1645. `=QUOTIENT(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1646. "=QUOTIENT(1,0)": "#DIV/0!",
  1647. "=QUOTIENT(1)": "QUOTIENT requires 2 numeric arguments",
  1648. // RADIANS
  1649. `=RADIANS("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1650. "=RADIANS()": "RADIANS requires 1 numeric argument",
  1651. // RAND
  1652. "=RAND(1)": "RAND accepts no arguments",
  1653. // RANDBETWEEN
  1654. `=RANDBETWEEN("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1655. `=RANDBETWEEN(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1656. "=RANDBETWEEN()": "RANDBETWEEN requires 2 numeric arguments",
  1657. "=RANDBETWEEN(2,1)": "#NUM!",
  1658. // ROMAN
  1659. "=ROMAN()": "ROMAN requires at least 1 argument",
  1660. "=ROMAN(1,2,3)": "ROMAN allows at most 2 arguments",
  1661. `=ROMAN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1662. `=ROMAN("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1663. // ROUND
  1664. "=ROUND()": "ROUND requires 2 numeric arguments",
  1665. `=ROUND("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1666. `=ROUND(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1667. // ROUNDDOWN
  1668. "=ROUNDDOWN()": "ROUNDDOWN requires 2 numeric arguments",
  1669. `=ROUNDDOWN("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1670. `=ROUNDDOWN(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1671. // ROUNDUP
  1672. "=ROUNDUP()": "ROUNDUP requires 2 numeric arguments",
  1673. `=ROUNDUP("X",1)`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1674. `=ROUNDUP(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1675. // SEC
  1676. "=_xlfn.SEC()": "SEC requires 1 numeric argument",
  1677. `=_xlfn.SEC("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1678. // _xlfn.SECH
  1679. "=_xlfn.SECH()": "SECH requires 1 numeric argument",
  1680. `=_xlfn.SECH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1681. // SIGN
  1682. "=SIGN()": "SIGN requires 1 numeric argument",
  1683. `=SIGN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1684. // SIN
  1685. "=SIN()": "SIN requires 1 numeric argument",
  1686. `=SIN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1687. // SINH
  1688. "=SINH()": "SINH requires 1 numeric argument",
  1689. `=SINH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1690. // SQRT
  1691. "=SQRT()": "SQRT requires 1 numeric argument",
  1692. `=SQRT("")`: "strconv.ParseFloat: parsing \"\": invalid syntax",
  1693. `=SQRT("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1694. "=SQRT(-1)": "#NUM!",
  1695. // SQRTPI
  1696. "=SQRTPI()": "SQRTPI requires 1 numeric argument",
  1697. `=SQRTPI("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1698. // STDEV
  1699. "=STDEV()": "STDEV requires at least 1 argument",
  1700. "=STDEV(E2:E9)": "#DIV/0!",
  1701. // STDEV.S
  1702. "=STDEV.S()": "STDEV.S requires at least 1 argument",
  1703. // STDEVA
  1704. "=STDEVA()": "STDEVA requires at least 1 argument",
  1705. "=STDEVA(E2:E9)": "#DIV/0!",
  1706. // POISSON.DIST
  1707. "=POISSON.DIST()": "POISSON.DIST requires 3 arguments",
  1708. // POISSON
  1709. "=POISSON()": "POISSON requires 3 arguments",
  1710. "=POISSON(\"\",0,FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1711. "=POISSON(0,\"\",FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1712. "=POISSON(0,0,\"\")": "strconv.ParseBool: parsing \"\": invalid syntax",
  1713. "=POISSON(0,-1,TRUE)": "#N/A",
  1714. // SUM
  1715. "=SUM((": ErrInvalidFormula.Error(),
  1716. "=SUM(-)": ErrInvalidFormula.Error(),
  1717. "=SUM(1+)": ErrInvalidFormula.Error(),
  1718. "=SUM(1-)": ErrInvalidFormula.Error(),
  1719. "=SUM(1*)": ErrInvalidFormula.Error(),
  1720. "=SUM(1/)": ErrInvalidFormula.Error(),
  1721. // SUMIF
  1722. "=SUMIF()": "SUMIF requires at least 2 argument",
  1723. // SUMSQ
  1724. `=SUMSQ("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1725. "=SUMSQ(C1:D2)": "strconv.ParseFloat: parsing \"Month\": invalid syntax",
  1726. // TAN
  1727. "=TAN()": "TAN requires 1 numeric argument",
  1728. `=TAN("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1729. // TANH
  1730. "=TANH()": "TANH requires 1 numeric argument",
  1731. `=TANH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1732. // TRUNC
  1733. "=TRUNC()": "TRUNC requires at least 1 argument",
  1734. `=TRUNC("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1735. `=TRUNC(1,"X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
  1736. // Statistical Functions
  1737. // AVERAGE
  1738. "=AVERAGE(H1)": "AVERAGE divide by zero",
  1739. // AVERAGE
  1740. "=AVERAGEA(H1)": "AVERAGEA divide by zero",
  1741. // COUNTBLANK
  1742. "=COUNTBLANK()": "COUNTBLANK requires 1 argument",
  1743. "=COUNTBLANK(1,2)": "COUNTBLANK requires 1 argument",
  1744. // FISHER
  1745. "=FISHER()": "FISHER requires 1 numeric argument",
  1746. "=FISHER(2)": "#N/A",
  1747. "=FISHER(INT(-2)))": "#N/A",
  1748. "=FISHER(F1)": "FISHER requires 1 numeric argument",
  1749. // FISHERINV
  1750. "=FISHERINV()": "FISHERINV requires 1 numeric argument",
  1751. "=FISHERINV(F1)": "FISHERINV requires 1 numeric argument",
  1752. // GAMMA
  1753. "=GAMMA()": "GAMMA requires 1 numeric argument",
  1754. "=GAMMA(F1)": "GAMMA requires 1 numeric argument",
  1755. "=GAMMA(0)": "#N/A",
  1756. "=GAMMA(INT(0))": "#N/A",
  1757. // GAMMALN
  1758. "=GAMMALN()": "GAMMALN requires 1 numeric argument",
  1759. "=GAMMALN(F1)": "GAMMALN requires 1 numeric argument",
  1760. "=GAMMALN(0)": "#N/A",
  1761. "=GAMMALN(INT(0))": "#N/A",
  1762. // HARMEAN
  1763. "=HARMEAN()": "HARMEAN requires at least 1 argument",
  1764. "=HARMEAN(-1)": "#N/A",
  1765. "=HARMEAN(0)": "#N/A",
  1766. // KURT
  1767. "=KURT()": "KURT requires at least 1 argument",
  1768. "=KURT(F1,INT(1))": "#DIV/0!",
  1769. // NORM.DIST
  1770. "=NORM.DIST()": "NORM.DIST requires 4 arguments",
  1771. // NORMDIST
  1772. "=NORMDIST()": "NORMDIST requires 4 arguments",
  1773. "=NORMDIST(\"\",0,0,FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1774. "=NORMDIST(0,\"\",0,FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1775. "=NORMDIST(0,0,\"\",FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1776. "=NORMDIST(0,0,0,\"\")": "strconv.ParseBool: parsing \"\": invalid syntax",
  1777. "=NORMDIST(0,0,-1,TRUE)": "#N/A",
  1778. // NORM.INV
  1779. "=NORM.INV()": "NORM.INV requires 3 arguments",
  1780. // NORMINV
  1781. "=NORMINV()": "NORMINV requires 3 arguments",
  1782. "=NORMINV(\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1783. "=NORMINV(0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1784. "=NORMINV(0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1785. "=NORMINV(0,0,-1)": "#N/A",
  1786. "=NORMINV(-1,0,0)": "#N/A",
  1787. "=NORMINV(0,0,0)": "#NUM!",
  1788. // NORM.S.DIST
  1789. "=NORM.S.DIST()": "NORM.S.DIST requires 2 numeric arguments",
  1790. // NORMSDIST
  1791. "=NORMSDIST()": "NORMSDIST requires 1 numeric argument",
  1792. // NORM.S.INV
  1793. "=NORM.S.INV()": "NORM.S.INV requires 1 numeric argument",
  1794. // NORMSINV
  1795. "=NORMSINV()": "NORMSINV requires 1 numeric argument",
  1796. // LARGE
  1797. "=LARGE()": "LARGE requires 2 arguments",
  1798. "=LARGE(A1:A5,0)": "k should be > 0",
  1799. "=LARGE(A1:A5,6)": "k should be <= length of array",
  1800. "=LARGE(A1:A5,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1801. // MAX
  1802. "=MAX()": "MAX requires at least 1 argument",
  1803. "=MAX(NA())": "#N/A",
  1804. // MAXA
  1805. "=MAXA()": "MAXA requires at least 1 argument",
  1806. "=MAXA(NA())": "#N/A",
  1807. // MEDIAN
  1808. "=MEDIAN()": "MEDIAN requires at least 1 argument",
  1809. "=MEDIAN(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1810. "=MEDIAN(D1:D2)": "strconv.ParseFloat: parsing \"Month\": invalid syntax",
  1811. // MIN
  1812. "=MIN()": "MIN requires at least 1 argument",
  1813. "=MIN(NA())": "#N/A",
  1814. // MINA
  1815. "=MINA()": "MINA requires at least 1 argument",
  1816. "=MINA(NA())": "#N/A",
  1817. // PERCENTILE.INC
  1818. "=PERCENTILE.INC()": "PERCENTILE.INC requires 2 arguments",
  1819. // PERCENTILE
  1820. "=PERCENTILE()": "PERCENTILE requires 2 arguments",
  1821. "=PERCENTILE(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1822. "=PERCENTILE(0,-1)": "#N/A",
  1823. "=PERCENTILE(NA(),1)": "#N/A",
  1824. // PERMUT
  1825. "=PERMUT()": "PERMUT requires 2 numeric arguments",
  1826. "=PERMUT(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1827. "=PERMUT(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1828. "=PERMUT(6,8)": "#N/A",
  1829. // PERMUTATIONA
  1830. "=PERMUTATIONA()": "PERMUTATIONA requires 2 numeric arguments",
  1831. "=PERMUTATIONA(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1832. "=PERMUTATIONA(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1833. "=PERMUTATIONA(-1,0)": "#N/A",
  1834. "=PERMUTATIONA(0,-1)": "#N/A",
  1835. // QUARTILE
  1836. "=QUARTILE()": "QUARTILE requires 2 arguments",
  1837. "=QUARTILE(A1:A4,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1838. "=QUARTILE(A1:A4,-1)": "#NUM!",
  1839. "=QUARTILE(A1:A4,5)": "#NUM!",
  1840. // QUARTILE.INC
  1841. "=QUARTILE.INC()": "QUARTILE.INC requires 2 arguments",
  1842. // SKEW
  1843. "=SKEW()": "SKEW requires at least 1 argument",
  1844. "=SKEW(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1845. "=SKEW(0)": "#DIV/0!",
  1846. // SMALL
  1847. "=SMALL()": "SMALL requires 2 arguments",
  1848. "=SMALL(A1:A5,0)": "k should be > 0",
  1849. "=SMALL(A1:A5,6)": "k should be <= length of array",
  1850. "=SMALL(A1:A5,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1851. // VARP
  1852. "=VARP()": "VARP requires at least 1 argument",
  1853. "=VARP(\"\")": "#DIV/0!",
  1854. // VAR.P
  1855. "=VAR.P()": "VAR.P requires at least 1 argument",
  1856. "=VAR.P(\"\")": "#DIV/0!",
  1857. // Information Functions
  1858. // ISBLANK
  1859. "=ISBLANK(A1,A2)": "ISBLANK requires 1 argument",
  1860. // ISERR
  1861. "=ISERR()": "ISERR requires 1 argument",
  1862. // ISERROR
  1863. "=ISERROR()": "ISERROR requires 1 argument",
  1864. // ISEVEN
  1865. "=ISEVEN()": "ISEVEN requires 1 argument",
  1866. `=ISEVEN("text")`: "strconv.Atoi: parsing \"text\": invalid syntax",
  1867. // ISNA
  1868. "=ISNA()": "ISNA requires 1 argument",
  1869. // ISNONTEXT
  1870. "=ISNONTEXT()": "ISNONTEXT requires 1 argument",
  1871. // ISNUMBER
  1872. "=ISNUMBER()": "ISNUMBER requires 1 argument",
  1873. // ISODD
  1874. "=ISODD()": "ISODD requires 1 argument",
  1875. `=ISODD("text")`: "strconv.Atoi: parsing \"text\": invalid syntax",
  1876. // ISTEXT
  1877. "=ISTEXT()": "ISTEXT requires 1 argument",
  1878. // N
  1879. "=N()": "N requires 1 argument",
  1880. "=N(NA())": "#N/A",
  1881. // NA
  1882. "=NA()": "#N/A",
  1883. "=NA(1)": "NA accepts no arguments",
  1884. // SHEET
  1885. "=SHEET(1)": "SHEET accepts no arguments",
  1886. // T
  1887. "=T()": "T requires 1 argument",
  1888. "=T(NA())": "#N/A",
  1889. // Logical Functions
  1890. // AND
  1891. `=AND("text")`: "strconv.ParseFloat: parsing \"text\": invalid syntax",
  1892. `=AND(A1:B1)`: "#VALUE!",
  1893. "=AND()": "AND requires at least 1 argument",
  1894. "=AND(1" + strings.Repeat(",1", 30) + ")": "AND accepts at most 30 arguments",
  1895. // FALSE
  1896. "=FALSE(A1)": "FALSE takes no arguments",
  1897. // IFERROR
  1898. "=IFERROR()": "IFERROR requires 2 arguments",
  1899. // NOT
  1900. "=NOT()": "NOT requires 1 argument",
  1901. "=NOT(NOT())": "NOT requires 1 argument",
  1902. "=NOT(\"\")": "NOT expects 1 boolean or numeric argument",
  1903. // OR
  1904. `=OR("text")`: "strconv.ParseFloat: parsing \"text\": invalid syntax",
  1905. `=OR(A1:B1)`: "#VALUE!",
  1906. "=OR()": "OR requires at least 1 argument",
  1907. "=OR(1" + strings.Repeat(",1", 30) + ")": "OR accepts at most 30 arguments",
  1908. // TRUE
  1909. "=TRUE(A1)": "TRUE takes no arguments",
  1910. // Date and Time Functions
  1911. // DATE
  1912. "=DATE()": "DATE requires 3 number arguments",
  1913. `=DATE("text",10,21)`: "DATE requires 3 number arguments",
  1914. `=DATE(2020,"text",21)`: "DATE requires 3 number arguments",
  1915. `=DATE(2020,10,"text")`: "DATE requires 3 number arguments",
  1916. // DATEDIF
  1917. "=DATEDIF()": "DATEDIF requires 3 number arguments",
  1918. "=DATEDIF(\"\",\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1919. "=DATEDIF(43891,43101,\"Y\")": "start_date > end_date",
  1920. "=DATEDIF(43101,43891,\"x\")": "DATEDIF has invalid unit",
  1921. // NOW
  1922. "=NOW(A1)": "NOW accepts no arguments",
  1923. // TODAY
  1924. "=TODAY(A1)": "TODAY accepts no arguments",
  1925. // Text Functions
  1926. // CHAR
  1927. "=CHAR()": "CHAR requires 1 argument",
  1928. "=CHAR(-1)": "#VALUE!",
  1929. "=CHAR(256)": "#VALUE!",
  1930. "=CHAR(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1931. // CLEAN
  1932. "=CLEAN()": "CLEAN requires 1 argument",
  1933. "=CLEAN(1,2)": "CLEAN requires 1 argument",
  1934. // CODE
  1935. "=CODE()": "CODE requires 1 argument",
  1936. "=CODE(1,2)": "CODE requires 1 argument",
  1937. // CONCAT
  1938. "=CONCAT(MUNIT(2))": "CONCAT requires arguments to be strings",
  1939. // CONCATENATE
  1940. "=CONCATENATE(MUNIT(2))": "CONCATENATE requires arguments to be strings",
  1941. // EXACT
  1942. "=EXACT()": "EXACT requires 2 arguments",
  1943. "=EXACT(1,2,3)": "EXACT requires 2 arguments",
  1944. // FIXED
  1945. "=FIXED()": "FIXED requires at least 1 argument",
  1946. "=FIXED(0,1,2,3)": "FIXED allows at most 3 arguments",
  1947. "=FIXED(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1948. "=FIXED(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1949. "=FIXED(0,0,\"\")": "strconv.ParseBool: parsing \"\": invalid syntax",
  1950. // FIND
  1951. "=FIND()": "FIND requires at least 2 arguments",
  1952. "=FIND(1,2,3,4)": "FIND allows at most 3 arguments",
  1953. "=FIND(\"x\",\"\")": "#VALUE!",
  1954. "=FIND(\"x\",\"x\",-1)": "#VALUE!",
  1955. "=FIND(\"x\",\"x\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1956. // FINDB
  1957. "=FINDB()": "FINDB requires at least 2 arguments",
  1958. "=FINDB(1,2,3,4)": "FINDB allows at most 3 arguments",
  1959. "=FINDB(\"x\",\"\")": "#VALUE!",
  1960. "=FINDB(\"x\",\"x\",-1)": "#VALUE!",
  1961. "=FINDB(\"x\",\"x\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1962. // LEFT
  1963. "=LEFT()": "LEFT requires at least 1 argument",
  1964. "=LEFT(\"\",2,3)": "LEFT allows at most 2 arguments",
  1965. "=LEFT(\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1966. "=LEFT(\"\",-1)": "#VALUE!",
  1967. // LEFTB
  1968. "=LEFTB()": "LEFTB requires at least 1 argument",
  1969. "=LEFTB(\"\",2,3)": "LEFTB allows at most 2 arguments",
  1970. "=LEFTB(\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1971. "=LEFTB(\"\",-1)": "#VALUE!",
  1972. // LEN
  1973. "=LEN()": "LEN requires 1 string argument",
  1974. // LENB
  1975. "=LENB()": "LENB requires 1 string argument",
  1976. // LOWER
  1977. "=LOWER()": "LOWER requires 1 argument",
  1978. "=LOWER(1,2)": "LOWER requires 1 argument",
  1979. // MID
  1980. "=MID()": "MID requires 3 arguments",
  1981. "=MID(\"\",-1,1)": "#VALUE!",
  1982. "=MID(\"\",\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1983. "=MID(\"\",1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1984. // MIDB
  1985. "=MIDB()": "MIDB requires 3 arguments",
  1986. "=MIDB(\"\",-1,1)": "#VALUE!",
  1987. "=MIDB(\"\",\"\",1)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1988. "=MIDB(\"\",1,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1989. // PROPER
  1990. "=PROPER()": "PROPER requires 1 argument",
  1991. "=PROPER(1,2)": "PROPER requires 1 argument",
  1992. // REPLACE
  1993. "=REPLACE()": "REPLACE requires 4 arguments",
  1994. "=REPLACE(\"text\",0,4,\"string\")": "#VALUE!",
  1995. "=REPLACE(\"text\",\"\",0,\"string\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1996. "=REPLACE(\"text\",1,\"\",\"string\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  1997. // REPLACEB
  1998. "=REPLACEB()": "REPLACEB requires 4 arguments",
  1999. "=REPLACEB(\"text\",0,4,\"string\")": "#VALUE!",
  2000. "=REPLACEB(\"text\",\"\",0,\"string\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2001. "=REPLACEB(\"text\",1,\"\",\"string\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2002. // REPT
  2003. "=REPT()": "REPT requires 2 arguments",
  2004. "=REPT(INT(0),2)": "REPT requires first argument to be a string",
  2005. "=REPT(\"*\",\"*\")": "REPT requires second argument to be a number",
  2006. "=REPT(\"*\",-1)": "REPT requires second argument to be >= 0",
  2007. // RIGHT
  2008. "=RIGHT()": "RIGHT requires at least 1 argument",
  2009. "=RIGHT(\"\",2,3)": "RIGHT allows at most 2 arguments",
  2010. "=RIGHT(\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2011. "=RIGHT(\"\",-1)": "#VALUE!",
  2012. // RIGHTB
  2013. "=RIGHTB()": "RIGHTB requires at least 1 argument",
  2014. "=RIGHTB(\"\",2,3)": "RIGHTB allows at most 2 arguments",
  2015. "=RIGHTB(\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2016. "=RIGHTB(\"\",-1)": "#VALUE!",
  2017. // SUBSTITUTE
  2018. "=SUBSTITUTE()": "SUBSTITUTE requires 3 or 4 arguments",
  2019. "=SUBSTITUTE(\"\",\"\",\"\",\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2020. "=SUBSTITUTE(\"\",\"\",\"\",0)": "instance_num should be > 0",
  2021. // TRIM
  2022. "=TRIM()": "TRIM requires 1 argument",
  2023. "=TRIM(1,2)": "TRIM requires 1 argument",
  2024. // UNICHAR
  2025. "=UNICHAR()": "UNICHAR requires 1 argument",
  2026. "=UNICHAR(\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2027. "=UNICHAR(55296)": "#VALUE!",
  2028. "=UNICHAR(0)": "#VALUE!",
  2029. // UNICODE
  2030. "=UNICODE()": "UNICODE requires 1 argument",
  2031. "=UNICODE(\"\")": "#VALUE!",
  2032. // UPPER
  2033. "=UPPER()": "UPPER requires 1 argument",
  2034. "=UPPER(1,2)": "UPPER requires 1 argument",
  2035. // Conditional Functions
  2036. // IF
  2037. "=IF()": "IF requires at least 1 argument",
  2038. "=IF(0,1,2,3)": "IF accepts at most 3 arguments",
  2039. "=IF(D1,1,2)": "strconv.ParseBool: parsing \"Month\": invalid syntax",
  2040. // Excel Lookup and Reference Functions
  2041. // CHOOSE
  2042. "=CHOOSE()": "CHOOSE requires 2 arguments",
  2043. "=CHOOSE(\"index_num\",0)": "CHOOSE requires first argument of type number",
  2044. "=CHOOSE(2,0)": "index_num should be <= to the number of values",
  2045. // COLUMN
  2046. "=COLUMN(1,2)": "COLUMN requires at most 1 argument",
  2047. "=COLUMN(\"\")": "invalid reference",
  2048. "=COLUMN(Sheet1)": "invalid column name \"Sheet1\"",
  2049. "=COLUMN(Sheet1!A1!B1)": "invalid column name \"Sheet1\"",
  2050. // COLUMNS
  2051. "=COLUMNS()": "COLUMNS requires 1 argument",
  2052. "=COLUMNS(1)": "invalid reference",
  2053. "=COLUMNS(\"\")": "invalid reference",
  2054. "=COLUMNS(Sheet1)": "invalid column name \"Sheet1\"",
  2055. "=COLUMNS(Sheet1!A1!B1)": "invalid column name \"Sheet1\"",
  2056. "=COLUMNS(Sheet1!Sheet1)": "invalid column name \"Sheet1\"",
  2057. // HLOOKUP
  2058. "=HLOOKUP()": "HLOOKUP requires at least 3 arguments",
  2059. "=HLOOKUP(D2,D1,1,FALSE)": "HLOOKUP requires second argument of table array",
  2060. "=HLOOKUP(D2,D:D,FALSE,FALSE)": "HLOOKUP requires numeric row argument",
  2061. "=HLOOKUP(D2,D:D,1,FALSE,FALSE)": "HLOOKUP requires at most 4 arguments",
  2062. "=HLOOKUP(D2,D:D,1,2)": "strconv.ParseBool: parsing \"2\": invalid syntax",
  2063. "=HLOOKUP(D2,D10:D10,1,FALSE)": "HLOOKUP no result found",
  2064. "=HLOOKUP(D2,D2:D3,4,FALSE)": "HLOOKUP has invalid row index",
  2065. "=HLOOKUP(D2,C:C,1,FALSE)": "HLOOKUP no result found",
  2066. "=HLOOKUP(ISNUMBER(1),F3:F9,1)": "HLOOKUP no result found",
  2067. "=HLOOKUP(INT(1),E2:E9,1)": "HLOOKUP no result found",
  2068. "=HLOOKUP(MUNIT(2),MUNIT(3),1)": "HLOOKUP no result found",
  2069. "=HLOOKUP(A1:B2,B2:B3,1)": "HLOOKUP no result found",
  2070. // VLOOKUP
  2071. "=VLOOKUP()": "VLOOKUP requires at least 3 arguments",
  2072. "=VLOOKUP(D2,D1,1,FALSE)": "VLOOKUP requires second argument of table array",
  2073. "=VLOOKUP(D2,D:D,FALSE,FALSE)": "VLOOKUP requires numeric col argument",
  2074. "=VLOOKUP(D2,D:D,1,FALSE,FALSE)": "VLOOKUP requires at most 4 arguments",
  2075. "=VLOOKUP(D2,D:D,1,2)": "strconv.ParseBool: parsing \"2\": invalid syntax",
  2076. "=VLOOKUP(D2,D10:D10,1,FALSE)": "VLOOKUP no result found",
  2077. "=VLOOKUP(D2,D:D,2,FALSE)": "VLOOKUP has invalid column index",
  2078. "=VLOOKUP(D2,C:C,1,FALSE)": "VLOOKUP no result found",
  2079. "=VLOOKUP(ISNUMBER(1),F3:F9,1)": "VLOOKUP no result found",
  2080. "=VLOOKUP(INT(1),E2:E9,1)": "VLOOKUP no result found",
  2081. "=VLOOKUP(MUNIT(2),MUNIT(3),1)": "VLOOKUP no result found",
  2082. "=VLOOKUP(1,G1:H2,1,FALSE)": "VLOOKUP no result found",
  2083. // LOOKUP
  2084. "=LOOKUP()": "LOOKUP requires at least 2 arguments",
  2085. "=LOOKUP(D2,D1,D2)": "LOOKUP requires second argument of table array",
  2086. "=LOOKUP(D2,D1,D2,FALSE)": "LOOKUP requires at most 3 arguments",
  2087. "=LOOKUP(D1,MUNIT(1),MUNIT(1))": "LOOKUP no result found",
  2088. // ROW
  2089. "=ROW(1,2)": "ROW requires at most 1 argument",
  2090. "=ROW(\"\")": "invalid reference",
  2091. "=ROW(Sheet1)": "invalid column name \"Sheet1\"",
  2092. "=ROW(Sheet1!A1!B1)": "invalid column name \"Sheet1\"",
  2093. // ROWS
  2094. "=ROWS()": "ROWS requires 1 argument",
  2095. "=ROWS(1)": "invalid reference",
  2096. "=ROWS(\"\")": "invalid reference",
  2097. "=ROWS(Sheet1)": "invalid column name \"Sheet1\"",
  2098. "=ROWS(Sheet1!A1!B1)": "invalid column name \"Sheet1\"",
  2099. "=ROWS(Sheet1!Sheet1)": "invalid column name \"Sheet1\"",
  2100. // Web Functions
  2101. // ENCODEURL
  2102. "=ENCODEURL()": "ENCODEURL requires 1 argument",
  2103. // Financial Functions
  2104. // CUMIPMT
  2105. "=CUMIPMT()": "CUMIPMT requires 6 arguments",
  2106. "=CUMIPMT(0,0,0,0,0,2)": "#N/A",
  2107. "=CUMIPMT(0,0,0,-1,0,0)": "#N/A",
  2108. "=CUMIPMT(0,0,0,1,0,0)": "#N/A",
  2109. "=CUMIPMT(\"\",0,0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2110. "=CUMIPMT(0,\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2111. "=CUMIPMT(0,0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2112. "=CUMIPMT(0,0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2113. "=CUMIPMT(0,0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2114. "=CUMIPMT(0,0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2115. // CUMPRINC
  2116. "=CUMPRINC()": "CUMPRINC requires 6 arguments",
  2117. "=CUMPRINC(0,0,0,0,0,2)": "#N/A",
  2118. "=CUMPRINC(0,0,0,-1,0,0)": "#N/A",
  2119. "=CUMPRINC(0,0,0,1,0,0)": "#N/A",
  2120. "=CUMPRINC(\"\",0,0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2121. "=CUMPRINC(0,\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2122. "=CUMPRINC(0,0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2123. "=CUMPRINC(0,0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2124. "=CUMPRINC(0,0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2125. "=CUMPRINC(0,0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2126. // DB
  2127. "=DB()": "DB requires at least 4 arguments",
  2128. "=DB(0,0,0,0,0,0)": "DB allows at most 5 arguments",
  2129. "=DB(-1,0,0,0)": "#N/A",
  2130. "=DB(\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2131. "=DB(0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2132. "=DB(0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2133. "=DB(0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2134. "=DB(0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2135. // DDB
  2136. "=DDB()": "DDB requires at least 4 arguments",
  2137. "=DDB(0,0,0,0,0,0)": "DDB allows at most 5 arguments",
  2138. "=DDB(-1,0,0,0)": "#N/A",
  2139. "=DDB(\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2140. "=DDB(0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2141. "=DDB(0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2142. "=DDB(0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2143. "=DDB(0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2144. // DOLLARDE
  2145. "=DOLLARDE()": "DOLLARDE requires 2 arguments",
  2146. "=DOLLARDE(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2147. "=DOLLARDE(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2148. "=DOLLARDE(0,-1)": "#NUM!",
  2149. "=DOLLARDE(0,0)": "#DIV/0!",
  2150. // DOLLARFR
  2151. "=DOLLARFR()": "DOLLARFR requires 2 arguments",
  2152. "=DOLLARFR(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2153. "=DOLLARFR(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2154. "=DOLLARFR(0,-1)": "#NUM!",
  2155. "=DOLLARFR(0,0)": "#DIV/0!",
  2156. // EFFECT
  2157. "=EFFECT()": "EFFECT requires 2 arguments",
  2158. "=EFFECT(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2159. "=EFFECT(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2160. "=EFFECT(0,0)": "#NUM!",
  2161. "=EFFECT(1,0)": "#NUM!",
  2162. // FV
  2163. "=FV()": "FV requires at least 3 arguments",
  2164. "=FV(0,0,0,0,0,0,0)": "FV allows at most 5 arguments",
  2165. "=FV(0,0,0,0,2)": "#N/A",
  2166. "=FV(\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2167. "=FV(0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2168. "=FV(0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2169. "=FV(0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2170. "=FV(0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2171. // FVSCHEDULE
  2172. "=FVSCHEDULE()": "FVSCHEDULE requires 2 arguments",
  2173. "=FVSCHEDULE(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2174. "=FVSCHEDULE(0,\"x\")": "strconv.ParseFloat: parsing \"x\": invalid syntax",
  2175. // IPMT
  2176. "=IPMT()": "IPMT requires at least 4 arguments",
  2177. "=IPMT(0,0,0,0,0,0,0)": "IPMT allows at most 6 arguments",
  2178. "=IPMT(0,0,0,0,0,2)": "#N/A",
  2179. "=IPMT(0,-1,0,0,0,0)": "#N/A",
  2180. "=IPMT(0,1,0,0,0,0)": "#N/A",
  2181. "=IPMT(\"\",0,0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2182. "=IPMT(0,\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2183. "=IPMT(0,0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2184. "=IPMT(0,0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2185. "=IPMT(0,0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2186. "=IPMT(0,0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2187. // ISPMT
  2188. "=ISPMT()": "ISPMT requires 4 arguments",
  2189. "=ISPMT(\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2190. "=ISPMT(0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2191. "=ISPMT(0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2192. "=ISPMT(0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2193. // NOMINAL
  2194. "=NOMINAL()": "NOMINAL requires 2 arguments",
  2195. "=NOMINAL(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2196. "=NOMINAL(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2197. "=NOMINAL(0,0)": "#NUM!",
  2198. "=NOMINAL(1,0)": "#NUM!",
  2199. // NPER
  2200. "=NPER()": "NPER requires at least 3 arguments",
  2201. "=NPER(0,0,0,0,0,0)": "NPER allows at most 5 arguments",
  2202. "=NPER(0,0,0)": "#NUM!",
  2203. "=NPER(0,0,0,0,2)": "#N/A",
  2204. "=NPER(\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2205. "=NPER(0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2206. "=NPER(0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2207. "=NPER(0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2208. "=NPER(0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2209. // NPV
  2210. "=NPV()": "NPV requires at least 2 arguments",
  2211. "=NPV(\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2212. // PDURATION
  2213. "=PDURATION()": "PDURATION requires 3 arguments",
  2214. "=PDURATION(\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2215. "=PDURATION(0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2216. "=PDURATION(0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2217. "=PDURATION(0,0,0)": "#NUM!",
  2218. // PMT
  2219. "=PMT()": "PMT requires at least 3 arguments",
  2220. "=PMT(0,0,0,0,0,0)": "PMT allows at most 5 arguments",
  2221. "=PMT(0,0,0,0,2)": "#N/A",
  2222. "=PMT(\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2223. "=PMT(0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2224. "=PMT(0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2225. "=PMT(0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2226. "=PMT(0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2227. // PPMT
  2228. "=PPMT()": "PPMT requires at least 4 arguments",
  2229. "=PPMT(0,0,0,0,0,0,0)": "PPMT allows at most 6 arguments",
  2230. "=PPMT(0,0,0,0,0,2)": "#N/A",
  2231. "=PPMT(0,-1,0,0,0,0)": "#N/A",
  2232. "=PPMT(0,1,0,0,0,0)": "#N/A",
  2233. "=PPMT(\"\",0,0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2234. "=PPMT(0,\"\",0,0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2235. "=PPMT(0,0,\"\",0,0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2236. "=PPMT(0,0,0,\"\",0,0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2237. "=PPMT(0,0,0,0,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2238. "=PPMT(0,0,0,0,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2239. }
  2240. for formula, expected := range mathCalcError {
  2241. f := prepareCalcData(cellData)
  2242. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", formula))
  2243. result, err := f.CalcCellValue("Sheet1", "C1")
  2244. assert.EqualError(t, err, expected, formula)
  2245. assert.Equal(t, "", result, formula)
  2246. }
  2247. referenceCalc := map[string]string{
  2248. // MDETERM
  2249. "=MDETERM(A1:B2)": "-3",
  2250. // PRODUCT
  2251. "=PRODUCT(Sheet1!A1:Sheet1!A1:A2,A2)": "4",
  2252. // IMPRODUCT
  2253. "=IMPRODUCT(Sheet1!A1:Sheet1!A1:A2,A2)": "4",
  2254. // SUM
  2255. "=A1/A3": "0.333333333333333",
  2256. "=SUM(A1:A2)": "3",
  2257. "=SUM(Sheet1!A1,A2)": "3",
  2258. "=(-2-SUM(-4+A2))*5": "0",
  2259. "=SUM(Sheet1!A1:Sheet1!A1:A2,A2)": "5",
  2260. "=SUM(A1,A2,A3)*SUM(2,3)": "30",
  2261. "=1+SUM(SUM(A1+A2/A3)*(2-3),2)": "1.333333333333334",
  2262. "=A1/A2/SUM(A1:A2:B1)": "0.041666666666667",
  2263. "=A1/A2/SUM(A1:A2:B1)*A3": "0.125",
  2264. "=SUM(B1:D1)": "4",
  2265. "=SUM(\"X\")": "0",
  2266. }
  2267. for formula, expected := range referenceCalc {
  2268. f := prepareCalcData(cellData)
  2269. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", formula))
  2270. result, err := f.CalcCellValue("Sheet1", "C1")
  2271. assert.NoError(t, err)
  2272. assert.Equal(t, expected, result, formula)
  2273. }
  2274. referenceCalcError := map[string]string{
  2275. // MDETERM
  2276. "=MDETERM(A1:B3)": "#VALUE!",
  2277. // SUM
  2278. "=1+SUM(SUM(A1+A2/A4)*(2-3),2)": "#DIV/0!",
  2279. }
  2280. for formula, expected := range referenceCalcError {
  2281. f := prepareCalcData(cellData)
  2282. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", formula))
  2283. result, err := f.CalcCellValue("Sheet1", "C1")
  2284. assert.EqualError(t, err, expected)
  2285. assert.Equal(t, "", result, formula)
  2286. }
  2287. volatileFuncs := []string{
  2288. "=NOW()",
  2289. "=RAND()",
  2290. "=RANDBETWEEN(1,2)",
  2291. "=TODAY()",
  2292. }
  2293. for _, formula := range volatileFuncs {
  2294. f := prepareCalcData(cellData)
  2295. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", formula))
  2296. _, err := f.CalcCellValue("Sheet1", "C1")
  2297. assert.NoError(t, err)
  2298. }
  2299. // Test get calculated cell value on not formula cell.
  2300. f := prepareCalcData(cellData)
  2301. result, err := f.CalcCellValue("Sheet1", "A1")
  2302. assert.NoError(t, err)
  2303. assert.Equal(t, "", result)
  2304. // Test get calculated cell value on not exists worksheet.
  2305. f = prepareCalcData(cellData)
  2306. _, err = f.CalcCellValue("SheetN", "A1")
  2307. assert.EqualError(t, err, "sheet SheetN is not exist")
  2308. // Test get calculated cell value with not support formula.
  2309. f = prepareCalcData(cellData)
  2310. assert.NoError(t, f.SetCellFormula("Sheet1", "A1", "=UNSUPPORT(A1)"))
  2311. _, err = f.CalcCellValue("Sheet1", "A1")
  2312. assert.EqualError(t, err, "not support UNSUPPORT function")
  2313. assert.NoError(t, f.SaveAs(filepath.Join("test", "TestCalcCellValue.xlsx")))
  2314. }
  2315. func TestCalculate(t *testing.T) {
  2316. err := `strconv.ParseFloat: parsing "string": invalid syntax`
  2317. opd := NewStack()
  2318. opd.Push(efp.Token{TValue: "string"})
  2319. opt := efp.Token{TValue: "-", TType: efp.TokenTypeOperatorPrefix}
  2320. assert.EqualError(t, calculate(opd, opt), err)
  2321. opd.Push(efp.Token{TValue: "string"})
  2322. opd.Push(efp.Token{TValue: "string"})
  2323. opt = efp.Token{TValue: "-", TType: efp.TokenTypeOperatorInfix}
  2324. assert.EqualError(t, calculate(opd, opt), err)
  2325. }
  2326. func TestCalcWithDefinedName(t *testing.T) {
  2327. cellData := [][]interface{}{
  2328. {"A1 value", "B1 value", nil},
  2329. }
  2330. f := prepareCalcData(cellData)
  2331. assert.NoError(t, f.SetDefinedName(&DefinedName{Name: "defined_name1", RefersTo: "Sheet1!A1", Scope: "Workbook"}))
  2332. assert.NoError(t, f.SetDefinedName(&DefinedName{Name: "defined_name1", RefersTo: "Sheet1!B1", Scope: "Sheet1"}))
  2333. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", "=defined_name1"))
  2334. result, err := f.CalcCellValue("Sheet1", "C1")
  2335. assert.NoError(t, err)
  2336. // DefinedName with scope WorkSheet takes precedence over DefinedName with scope Workbook, so we should get B1 value
  2337. assert.Equal(t, "B1 value", result, "=defined_name1")
  2338. assert.NoError(t, f.SetCellFormula("Sheet1", "C1", "=CONCATENATE(\"<\",defined_name1,\">\")"))
  2339. result, err = f.CalcCellValue("Sheet1", "C1")
  2340. assert.NoError(t, err)
  2341. assert.Equal(t, "<B1 value>", result, "=defined_name1")
  2342. }
  2343. func TestCalcArithmeticOperations(t *testing.T) {
  2344. err := `strconv.ParseFloat: parsing "text": invalid syntax`
  2345. assert.EqualError(t, calcPow("1", "text", nil), err)
  2346. assert.EqualError(t, calcPow("text", "1", nil), err)
  2347. assert.EqualError(t, calcL("1", "text", nil), err)
  2348. assert.EqualError(t, calcL("text", "1", nil), err)
  2349. assert.EqualError(t, calcLe("1", "text", nil), err)
  2350. assert.EqualError(t, calcLe("text", "1", nil), err)
  2351. assert.EqualError(t, calcG("1", "text", nil), err)
  2352. assert.EqualError(t, calcG("text", "1", nil), err)
  2353. assert.EqualError(t, calcGe("1", "text", nil), err)
  2354. assert.EqualError(t, calcGe("text", "1", nil), err)
  2355. assert.EqualError(t, calcAdd("1", "text", nil), err)
  2356. assert.EqualError(t, calcAdd("text", "1", nil), err)
  2357. assert.EqualError(t, calcAdd("1", "text", nil), err)
  2358. assert.EqualError(t, calcAdd("text", "1", nil), err)
  2359. assert.EqualError(t, calcSubtract("1", "text", nil), err)
  2360. assert.EqualError(t, calcSubtract("text", "1", nil), err)
  2361. assert.EqualError(t, calcMultiply("1", "text", nil), err)
  2362. assert.EqualError(t, calcMultiply("text", "1", nil), err)
  2363. assert.EqualError(t, calcDiv("1", "text", nil), err)
  2364. assert.EqualError(t, calcDiv("text", "1", nil), err)
  2365. }
  2366. func TestCalcISBLANK(t *testing.T) {
  2367. argsList := list.New()
  2368. argsList.PushBack(formulaArg{
  2369. Type: ArgUnknown,
  2370. })
  2371. fn := formulaFuncs{}
  2372. result := fn.ISBLANK(argsList)
  2373. assert.Equal(t, result.String, "TRUE")
  2374. assert.Empty(t, result.Error)
  2375. }
  2376. func TestCalcAND(t *testing.T) {
  2377. argsList := list.New()
  2378. argsList.PushBack(formulaArg{
  2379. Type: ArgUnknown,
  2380. })
  2381. fn := formulaFuncs{}
  2382. result := fn.AND(argsList)
  2383. assert.Equal(t, result.String, "")
  2384. assert.Empty(t, result.Error)
  2385. }
  2386. func TestCalcOR(t *testing.T) {
  2387. argsList := list.New()
  2388. argsList.PushBack(formulaArg{
  2389. Type: ArgUnknown,
  2390. })
  2391. fn := formulaFuncs{}
  2392. result := fn.OR(argsList)
  2393. assert.Equal(t, result.String, "FALSE")
  2394. assert.Empty(t, result.Error)
  2395. }
  2396. func TestCalcDet(t *testing.T) {
  2397. assert.Equal(t, det([][]float64{
  2398. {1, 2, 3, 4},
  2399. {2, 3, 4, 5},
  2400. {3, 4, 5, 6},
  2401. {4, 5, 6, 7},
  2402. }), float64(0))
  2403. }
  2404. func TestCalcToBool(t *testing.T) {
  2405. b := newBoolFormulaArg(true).ToBool()
  2406. assert.Equal(t, b.Boolean, true)
  2407. assert.Equal(t, b.Number, 1.0)
  2408. }
  2409. func TestCalcToList(t *testing.T) {
  2410. assert.Equal(t, []formulaArg(nil), newEmptyFormulaArg().ToList())
  2411. formulaList := []formulaArg{newEmptyFormulaArg()}
  2412. assert.Equal(t, formulaList, newListFormulaArg(formulaList).ToList())
  2413. }
  2414. func TestCalcCompareFormulaArg(t *testing.T) {
  2415. assert.Equal(t, compareFormulaArg(newEmptyFormulaArg(), newEmptyFormulaArg(), false, false), criteriaEq)
  2416. lhs := newListFormulaArg([]formulaArg{newEmptyFormulaArg()})
  2417. rhs := newListFormulaArg([]formulaArg{newEmptyFormulaArg(), newEmptyFormulaArg()})
  2418. assert.Equal(t, compareFormulaArg(lhs, rhs, false, false), criteriaL)
  2419. assert.Equal(t, compareFormulaArg(rhs, lhs, false, false), criteriaG)
  2420. lhs = newListFormulaArg([]formulaArg{newBoolFormulaArg(true)})
  2421. rhs = newListFormulaArg([]formulaArg{newBoolFormulaArg(true)})
  2422. assert.Equal(t, compareFormulaArg(lhs, rhs, false, false), criteriaEq)
  2423. assert.Equal(t, compareFormulaArg(formulaArg{Type: ArgUnknown}, formulaArg{Type: ArgUnknown}, false, false), criteriaErr)
  2424. }
  2425. func TestCalcMatchPattern(t *testing.T) {
  2426. assert.True(t, matchPattern("", ""))
  2427. assert.True(t, matchPattern("file/*", "file/abc/bcd/def"))
  2428. assert.True(t, matchPattern("*", ""))
  2429. assert.False(t, matchPattern("file/?", "file/abc/bcd/def"))
  2430. }
  2431. func TestCalcVLOOKUP(t *testing.T) {
  2432. cellData := [][]interface{}{
  2433. {nil, nil, nil, nil, nil, nil},
  2434. {nil, "Score", "Grade", nil, nil, nil},
  2435. {nil, 0, "F", nil, "Score", 85},
  2436. {nil, 60, "D", nil, "Grade"},
  2437. {nil, 70, "C", nil, nil, nil},
  2438. {nil, 80, "b", nil, nil, nil},
  2439. {nil, 90, "A", nil, nil, nil},
  2440. {nil, 85, "B", nil, nil, nil},
  2441. {nil, nil, nil, nil, nil, nil},
  2442. }
  2443. f := prepareCalcData(cellData)
  2444. calc := map[string]string{
  2445. "=VLOOKUP(F3,B3:C8,2)": "b",
  2446. "=VLOOKUP(F3,B3:C8,2,TRUE)": "b",
  2447. "=VLOOKUP(F3,B3:C8,2,FALSE)": "B",
  2448. }
  2449. for formula, expected := range calc {
  2450. assert.NoError(t, f.SetCellFormula("Sheet1", "F4", formula))
  2451. result, err := f.CalcCellValue("Sheet1", "F4")
  2452. assert.NoError(t, err, formula)
  2453. assert.Equal(t, expected, result, formula)
  2454. }
  2455. calcError := map[string]string{
  2456. "=VLOOKUP(INT(1),C3:C3,1,FALSE)": "VLOOKUP no result found",
  2457. }
  2458. for formula, expected := range calcError {
  2459. assert.NoError(t, f.SetCellFormula("Sheet1", "F4", formula))
  2460. result, err := f.CalcCellValue("Sheet1", "F4")
  2461. assert.EqualError(t, err, expected, formula)
  2462. assert.Equal(t, "", result, formula)
  2463. }
  2464. }
  2465. func TestCalcBoolean(t *testing.T) {
  2466. cellData := [][]interface{}{
  2467. {0.5, "TRUE", -0.5, "FALSE"},
  2468. }
  2469. f := prepareCalcData(cellData)
  2470. formulaList := map[string]string{
  2471. "=AVERAGEA(A1:C1)": "0.333333333333333",
  2472. "=MAX(0.5,B1)": "0.5",
  2473. "=MAX(A1:B1)": "0.5",
  2474. "=MAXA(A1:B1)": "1",
  2475. "=MAXA(0.5,B1)": "1",
  2476. "=MIN(-0.5,D1)": "-0.5",
  2477. "=MIN(C1:D1)": "-0.5",
  2478. "=MINA(C1:D1)": "-0.5",
  2479. "=MINA(-0.5,D1)": "-0.5",
  2480. "=STDEV(A1:C1)": "0.707106781186548",
  2481. "=STDEV(A1,B1,C1)": "0.707106781186548",
  2482. "=STDEVA(A1:C1,B1)": "0.707106781186548",
  2483. }
  2484. for formula, expected := range formulaList {
  2485. assert.NoError(t, f.SetCellFormula("Sheet1", "B10", formula))
  2486. result, err := f.CalcCellValue("Sheet1", "B10")
  2487. assert.NoError(t, err, formula)
  2488. assert.Equal(t, expected, result, formula)
  2489. }
  2490. }
  2491. func TestCalcHLOOKUP(t *testing.T) {
  2492. cellData := [][]interface{}{
  2493. {"Example Result Table"},
  2494. {nil, "A", "B", "C", "E", "F"},
  2495. {"Math", .58, .9, .67, .76, .8},
  2496. {"French", .61, .71, .59, .59, .76},
  2497. {"Physics", .75, .45, .39, .52, .69},
  2498. {"Biology", .39, .55, .77, .61, .45},
  2499. {},
  2500. {"Individual Student Score"},
  2501. {"Student:", "Biology Score:"},
  2502. {"E"},
  2503. }
  2504. f := prepareCalcData(cellData)
  2505. formulaList := map[string]string{
  2506. "=HLOOKUP(A10,A2:F6,5,FALSE)": "0.61",
  2507. "=HLOOKUP(D3,D3:D3,1,TRUE)": "0.67",
  2508. "=HLOOKUP(F3,D3:F3,1,TRUE)": "0.8",
  2509. "=HLOOKUP(A5,A2:F2,1,TRUE)": "F",
  2510. "=HLOOKUP(\"D\",A2:F2,1,TRUE)": "C",
  2511. }
  2512. for formula, expected := range formulaList {
  2513. assert.NoError(t, f.SetCellFormula("Sheet1", "B10", formula))
  2514. result, err := f.CalcCellValue("Sheet1", "B10")
  2515. assert.NoError(t, err, formula)
  2516. assert.Equal(t, expected, result, formula)
  2517. }
  2518. calcError := map[string]string{
  2519. "=HLOOKUP(INT(1),A3:A3,1,FALSE)": "HLOOKUP no result found",
  2520. }
  2521. for formula, expected := range calcError {
  2522. assert.NoError(t, f.SetCellFormula("Sheet1", "B10", formula))
  2523. result, err := f.CalcCellValue("Sheet1", "B10")
  2524. assert.EqualError(t, err, expected, formula)
  2525. assert.Equal(t, "", result, formula)
  2526. }
  2527. }
  2528. func TestCalcIRR(t *testing.T) {
  2529. cellData := [][]interface{}{{-1}, {0.2}, {0.24}, {0.288}, {0.3456}, {0.4147}}
  2530. f := prepareCalcData(cellData)
  2531. formulaList := map[string]string{
  2532. "=IRR(A1:A4)": "-0.136189509034157",
  2533. "=IRR(A1:A6)": "0.130575760006905",
  2534. "=IRR(A1:A4,-0.1)": "-0.136189514994621",
  2535. }
  2536. for formula, expected := range formulaList {
  2537. assert.NoError(t, f.SetCellFormula("Sheet1", "B1", formula))
  2538. result, err := f.CalcCellValue("Sheet1", "B1")
  2539. assert.NoError(t, err, formula)
  2540. assert.Equal(t, expected, result, formula)
  2541. }
  2542. calcError := map[string]string{
  2543. "=IRR()": "IRR requires at least 1 argument",
  2544. "=IRR(0,0,0)": "IRR allows at most 2 arguments",
  2545. "=IRR(0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2546. "=IRR(A2:A3)": "#NUM!",
  2547. }
  2548. for formula, expected := range calcError {
  2549. assert.NoError(t, f.SetCellFormula("Sheet1", "B1", formula))
  2550. result, err := f.CalcCellValue("Sheet1", "B1")
  2551. assert.EqualError(t, err, expected, formula)
  2552. assert.Equal(t, "", result, formula)
  2553. }
  2554. }
  2555. func TestCalcMIRR(t *testing.T) {
  2556. cellData := [][]interface{}{{-100}, {18}, {22.5}, {28}, {35.5}, {45}}
  2557. f := prepareCalcData(cellData)
  2558. formulaList := map[string]string{
  2559. "=MIRR(A1:A5,0.055,0.05)": "0.025376365108071",
  2560. "=MIRR(A1:A6,0.055,0.05)": "0.1000268752662",
  2561. }
  2562. for formula, expected := range formulaList {
  2563. assert.NoError(t, f.SetCellFormula("Sheet1", "B1", formula))
  2564. result, err := f.CalcCellValue("Sheet1", "B1")
  2565. assert.NoError(t, err, formula)
  2566. assert.Equal(t, expected, result, formula)
  2567. }
  2568. calcError := map[string]string{
  2569. "=MIRR()": "MIRR requires 3 arguments",
  2570. "=MIRR(A1:A5,\"\",0)": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2571. "=MIRR(A1:A5,0,\"\")": "strconv.ParseFloat: parsing \"\": invalid syntax",
  2572. "=MIRR(B1:B5,0,0)": "#DIV/0!",
  2573. }
  2574. for formula, expected := range calcError {
  2575. assert.NoError(t, f.SetCellFormula("Sheet1", "B1", formula))
  2576. result, err := f.CalcCellValue("Sheet1", "B1")
  2577. assert.EqualError(t, err, expected, formula)
  2578. assert.Equal(t, "", result, formula)
  2579. }
  2580. }