I have a column of e-mail addresses and wanted to just get the domain names. So, if I had whackamole@sdmb.com I wanted another column to look at that and fill in sdmb.com.
After fiddling around I finally found a solution which was the following code:
=RIGHT(A1,LEN(A1)- FIND(“@”,A1))
It works so happy about that but I’d like to understand what it is doing so I can apply it or some form of it to future issues. As it is I cannot for the life of me read what it is doing. To me it looks like…ahh heck. Tried a few times to write what I see but my attempt is a mess (finding @ in A1, getting the number of characters (LEN function), going right of what)?
Bleh…maybe it is just me but that is not intuitive. Note that my previous attempts failed and for some reason the LEN function seemed to be the important difference but why counting the characters is necessary is beyond me.
FIND("@", A1) finds the location (index) of a substring within the string in A1. So in other words, it returns the number of characters into the string that the @ appears.
LEN(A1) returns the total length of the string in A1.
The RIGHT function returns a substring, starting from the end of the string and counting a number of characters backwards. (IOW, starting from the RIGHT side of the string and going left.)
So, the formula says, “starting from the end of the string in A1, return a substring going back a number of characters equal to the total length of A1, minus the location of the “@” in A1.”
Thanks…still not feeling it on gut level yet but a few careful readings of it I think I am getting it. Note it is not so much the explanation, but what Excel is seeing and how it goes about processing that formula I am not finding intuitive.
No, it is not intuitive. But if you look at the basics of what your brain does and realize that Excel can only mimic that character-by-character, it will make sense, I think.
Your brain:
[ol]
[li]Find the @[/li][li]Pay attention to everything to the right of it[/li][/ol]
Excel:
[ol]
[li]Find the @[/li][li]Count the number of characters from the beginning of the string to the @[/li][li]Count the number of characters in the entire string[/li][li]Substract value from (2) from value from (3)[/li][li]Pay attention only to the characters in the string starting at the value derived in (4)[/li][/ol]