I'm totally stuck on creating a user defined function in Excel VBA for the following problem. Any help would be greatly appreciated.
My excel file looks like this (only adding a small portion for the sake of brevity):
A B C D
1 Susan Reagan Smith
2 Jill L Taylor
3 Sarah Sullivan Williams
4 Roger J Lopez
I would like a function that determines: If A1 = Susan OR Jill OR Sarah, AND LEN (length of string) of B1 >1 THEN D1 = A1 /2 B1 C1 ELSE A1 /2 C1
So the output in column D would look like:
A B C D
1 Susan Reagan Smith Susan /2 Reagan Smith
2 Jill L Taylor Jill /2 Taylor
3 Sarah Sullivan Williams Sarah /2 Sullivan Williams
4 Roger J Lopez Roger /2 Lopez
I want to use VBA because I have many names to add and don't really want a huge formula in cell D1 with a lot of nested if statements. I've been working on it myself but it's just a mess and I'm too embarrassed to post it here. Thanks guys!