Thursday, 1 November 2018

IMPROVISED NUMBER TO WORD WITH RINGGIT AND SEN NOTATION

NUMBER TO WORD WITH "RINGGIT" AND "SEN" NOTATION


I have improvised but have not tested the following codes.


You are free to C&P and use it but I shall not be bound legally arising from the use of the codes.


As per the earlier version, this version is still limited to 6 digit before decimal point/dot.
For codes up to 16 digits please email me at mohdarismail@gmail.com or @ whatsApp  


Please do leave comment so that I can improvise the codes.


The Malay version will be posted later.

I also have the code written number to word conversion in

Excel VBA for excel,
Google App Script for Google sheet ,
MS Access Database query,
mySql Database query
javaScript
.js for use with JSON



HOW TO USE ON GOOGLE SHEET



1. Open Google sheet


2. Cut & Paste the code from mohdarismail.blogspot.com


3. On your google sheet go to → Tools → Script Editor and paste the codes


4. Run the code from the Script editor


5. Watch your google sheet


6. Type your input value


7. You can drag and drop the in/output cell to any cell address you require the function to work.


Start ---->  


function N2W() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A1').activate();
spreadsheet.getActiveRangeList().setNumberFormat('0.00');
spreadsheet.getActiveSheet().setColumnWidth(2, 600);
spreadsheet.getRange('A1:B1').activate();
spreadsheet.getActiveRangeList().setWrapStrategy(SpreadsheetApp.WrapStrategy.WRAP);
spreadsheet.getRange('B1').activate();
spreadsheet.getCurrentCell().setFormula('=\n\nIF(ISBLANK(A1),"<---- PLEASE ENTER YOUR VALUE IN CELL A1 ON THE IMMEDIATE LEFT COLUMN",\n\n\nif(\n\n(value(left(A1,(find(".",A1))-1)))>999999,"This version is limited to 6 digit (before decimal/dot) only",\n\n"Ringgit Malaysia : "&\n\nif((value(left(A1,(find(".",A1))-1)))=0,"Nil",\n\ntrim(if(\n\nAND(value(right((value(left(A1,(find(".",A1))-1))),6))>99999,value(right((value(left(A1,(find(".",A1))-1))),6))<1000000),\n\nindex({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,value(left(right((value(left(A1,(find(".",A1))-1))),6),1))+1)&" "&"Hundred"&" "&if(value(index\n\n({"100000","200000","300000","400000","500000","600000","700000","800000","900000"},1,value(left(right((value(left(A1,(find(".",A1))-1))),6),1))))/1000=value(left(right((value\n\n(left(A1,(find(".",A1))-1))),6),3)),"Thousand",""),"")&" "&if(AND(value(right((value(left(A1,(find(".",A1))-1))),5))>19999,value(right((value(left(A1,(find(".",A1))-1))),5))\n\n<100000),index({"Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"},1,value(left(right((value(left(A1,(find(".",A1))-1))),5),1)-1)),"")&" "&if(AND(value(right\n\n((value(left(A1,(find(".",A1))-1))),5))>19999,value(right((value(left(A1,(find(".",A1))-1))),5))<100000),index\n\n({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,right(left(right((value(left(A1,(find(".",A1))-1))),5),2),1)+1)&" "&"Thousand","")&" "&if(AND(value(right\n\n((value(left(A1,(find(".",A1))-1))),5))>9999,value(right((value(left(A1,(find(".",A1))-1))),5))<20000),index\n\n({"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"},1,value(left(right((value(left(A1,(find(".",A1))-1))),5),2))-9)&" \n\n"&"Thousand","")&" "&if(AND(value(right((value(left(A1,(find(".",A1))-1))),5))>999,value(right((value(left(A1,(find(".",A1))-1))),5))<10000),concatenate(index\n\n({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,value(left(right((value(left(A1,(find(".",A1))-1))),4),1))+1)," ","Thousand"),"")&" "&if(AND(value(right\n\n((value(left(A1,(find(".",A1))-1))),3))>99, value(right((value(left(A1,(find(".",A1))-1))),3))<1000), concatenate(index\n\n({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,value(left(right((value(left(A1,(find(".",A1))-1))),3),1))+1)," ","Hundred"),"")&" "&if(AND(value(right\n\n((value(left(A1,(find(".",A1))-1))),2))>19,value(right((value(left(A1,(find(".",A1))-1))),2))<100),index\n\n({"","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"},1, (value(left(right((value(left(A1,(find(".",A1))-1))),2),1)))),"")&" "&if(AND(value(right((value\n\n(left(A1,(find(".",A1))-1))),2))>9,value(right((value(left(A1,(find(".",A1))-1))),2))<20),index\n\n({"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"},1,right((value(left(A1,(find(".",A1))-1))),1)+1),"")&" "&if(OR(value(right\n\n((value(left(A1,(find(".",A1))-1))),2))>20,value(right((value(left(A1,(find(".",A1))-1))),2))<10),index\n\n({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,right((value(left(A1,(find(".",A1))-1))),1)+1)\n\n,""))\n\n)\n\n&" "&\n\n"And Sen : "&trim(if((value(right(value(mid(A1,find(".",A1)+1,2)),2)))=0,"Nil",if(AND(value(right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),2))>19,value(right((value\n\n(right(value(mid(A1,find(".",A1)+1,2)),2))),2))<100),index({"","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"},1, (value(left(right((value(right(value(mid\n\n(A1,find(".",A1)+1,2)),2))),2),1)))),"")&" "&\nif(AND(value(right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),2))>9,value(right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),2))<20),index\n\n({"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"},1,right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),1)+1),"")&" "&\nif(OR(value(right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),2))>20,value(right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),2))<10),index\n\n({"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"},1,right((value(right(value(mid(A1,find(".",A1)+1,2)),2))),1)+1),"")))&" "&"Only"))');
};


←- End


Selamat mencuba !!!

No comments:

Post a Comment