Encode URL parameters in MS Excel 2013 and above

Function ENCODEURL() is good for encoding URL component but requires extra work to encode a string to be used in a query part of a URL.

More specifically ENCODEURL() encodes spaces as %20 instead of + character. This can be solved by substituting %20 with + in a string produced by ENCODEURL().

Example #1: A + B

=CONCATENATE("https://www.google.com/search?q=",SUBSTITUTE(ENCODEURL("A + B"),"%20","+"))



Example #2: Unicode support

=CONCATENATE("https://www.google.com/search?q=",SUBSTITUTE(ENCODEURL("Привет мир!"),"%20","+"))



Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.