I want a function in excel that i can call and pass a cell into. Input:
Firstname Lastname email@mail.com
Firstname midname Lastname email@mail.com
The number of spaces in between are random. Output should just be an array. The array can have any length since i don't know what the strings look like. Output should be:
Firstname, Lastname, email@mail.com
Firstname, midname, Lastname, email@mail.com
I will call the function from one cell like =MySplitFunction(A1)
, and that should put Firstname in A1, Lastname in B1, and email@mail.com in C1. I created a new module and tried the following code:
Function MySplitFunction(s As String) As String()
MySplitFunction = Split(s, " ")
End Function
Which gives me output
Firstname
How do i get it to return the whole array? Is it even possible to write a function in one cell that will put stuff in cells close to it?
EDIT: