Checks if entered mobile number is structurally valid or not. Currently this validation is done for Indian mobile numbers as follows:
mobile_number(String)
Cell Reference or Text containing mobile number
(Boolean) Validation result as TRUE / FALSE
Function ISVALIDMOBILE(mobile_number As String) As Boolean Dim expr As New RegExp expr.Pattern = "^(\(\+91\)|\+91|0)?[7-9][0-9]{9}$" ISVALIDMOBILE = expr.Test(mobile_number) End Function
/** * Structurally validates if given Indian mobile number is correct or not * * @param {string} mobile_number Mobile Number (India) to validate * @return TRUE/FALSE * @customfunction */ function ISVALIDMOBILE(mobile_number) { return /^(\(\+91\)|\+91|0)?[7-9][0-9]{9}$/g.test(mobile_number); }
Function ISVALIDMOBILE(mobile_number As String) As Boolean
Dim expr As New RegExp
expr.Pattern = "^(\(\+91\)|\+91|0)?[7-9][0-9]{9}$"
ISVALIDMOBILE = expr.Test(mobile_number)
End Function
/**
* Structurally validates if given Indian mobile number is correct or not
*
* @param {string} mobile_number Mobile Number (India) to validate
* @return TRUE/FALSE
* @customfunction
*/
function ISVALIDMOBILE(mobile_number) {
return /^(\(\+91\)|\+91|0)?[7-9][0-9]{9}$/g.test(mobile_number);
}
This Excel VBA Macro uses Regular Expression feature, which is not available by default. So it has to be referenced in VBA Project using below steps