S
S
StrapusCactus2017-09-28 14:41:25
excel
StrapusCactus, 2017-09-28 14:41:25

How to access list item?

Good afternoon. I am making a Name
list with the values ​​Vasya; Petya; Masha This list is located in cell A1 How can I access Masha? Or Petya ... Like A1: 1 or something like that ....

For fans of "Why do you need it?" - I want to make a condition, like If A1: 1, then I take information from another list, etc.

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
x67, 2017-09-28
@x67

Open the "Developer" tab (if not, then enable it) -> Visual Basic -> on the left find any sheet you know from the book, right click -> insert-> module
Double click on the new module, insert this function into it. Now it can be used in formulas and macros

Public Function GetListElement(CellText As String, num As Long) As String
    Elements = Split(CellText, ";")
    GetListElement = Elements(num - 1)
End Function

Usage example in formulas:
will return the second element of the list

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question