{"id":12190,"date":"2024-02-02T22:55:08","date_gmt":"2024-02-02T22:55:08","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/wp\/?p=3299"},"modified":"2024-02-02T22:55:08","modified_gmt":"2024-02-02T22:55:08","slug":"split-function-excel-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2024\/02\/split-function-excel-vba\/","title":{"rendered":"Excel VBA – What is SPLIT Function?"},"content":{"rendered":"
S<\/span>plit is the hardest shot to hit in Bowling. But unlike bowling SPLIT is very simple function to use in excel VBA. Splitting data or string in VBA, sometimes becomes necessary to organize it and to put it in more readable format.<\/p>\n
SPLIT-function<\/p><\/div>\n
Here in this article, you will learn about splitting the data\/string which is joined with a specific delimiter. Delimiter could be any character or special character. This VBA function basically finds each occurrence of the delimiter and split it and keep storing all the split sub-string in an array. Therefore this VBA function returns a String Array.<\/strong><\/p>\n
Split() Function<\/h1>\n
This is a VBA function not a Worksheet function (Excel formula). This function returns a one dimensional string array having all the strings split by provided delimiter<\/i><\/strong>. If delimiter is not found (even once) then the whole string will be returned by this function.<\/p>\n
Syntax:<\/h2>\n
This is how Syntax will look like as soon as you type VBA.Split <\/strong> in VB Editor \n<\/p>\n
Delimiter text by which above text has to be split. For example: Comma (,), Hyphen (-), etc. If this parameter is omitted then Space (” “) is considered as default delimiter.<\/p>\n
Limit (Optional) :<\/h2>\n
This is the maximum number of split in which original text has to be split. The default value is -1 which indicates to show all the split values.<\/p>\n
CompareMethod (Optional) :<\/h2>\n
This is a Numeric value ( 0 or 1) to indicate which method to use for comparison. 0<\/strong> is for performing a binary comparison. 1<\/strong> is for performing a textual comparison.<\/p>\n
Examples:<\/h1>\n
With the above theory you may not be more comfortable until you practice with some example by running the VBA code. I have taken few possible cases with different parameters in the below examples. They will make you more comfortable in using this function \ud83d\ude42<\/p>\n