Я понял. В демонстрационных целях я буду использовать для тестирования рабочих книг.
test1.xlsx
, книга с именем, фамилией, номером телефона и без адреса электронной почты ![введите здесь описание изображения](https://i.stack.imgur.com/FUInf.png)
test2.xlsx
, рабочая книга с именем, фамилией и адресом электронной почты ![введите здесь описание изображения](https://i.stack.imgur.com/eYrvO.png)
Поэтому мне нужно заполнить адреса электронной почты для каждой записи из test2.xlsx
в test1.xlsx
, проверив совпадение имен с помощью ВПР.
Шаг 1.) Мне нужно объединить поля first_name
и last_name
и сохранить значения в одной ячейке.
Сделать это:
а. Создайте новый столбец в каждой книге. Я назвал его full_name
![введите здесь описание изображения](https://i.stack.imgur.com/29WlB.png)
b. In the new column in each workbook, create the forumla
=(A2&B2)
. This will join the two values together. Like so:
c. Then select all the fields in that new
full_name
column and copy then paste special > values (to get rid of the formula)
![введите здесь описание изображения](https://i.stack.imgur.com/830tj.png)
Step 2.) Now that we have our new columns with the data we need to lookup in each workbook, we're going to create a new range in the workbook containing the email address (
test2.xlsx
). So highlight the two columns
full_name
and
email_address
and define a name.
Step 3.) Now return to your
test1.xlsx
workbook (the one that does not have the email addresses populated) and in the empty
email_address
cell (we'll start with E2), write the following formula in the formula bar:
=VLOOKUP(D2,test2.xlsx!emailinfo,2,FALSE)
Имея в виду, что синтаксис функции ВПР таков:
= VLOOKUP ( lookup_value , table_array , col_index_num , range_lookup )
Step 4.) Now let's say someone didn't have an email address, say Tom Jones. We're going to get a nasty looking
#N/A
value in our cell:
Чтобы избавиться от этого:
a. Select all the column headers by clicking the 1
b. Click Data > Filter icon. Uncheck
(Select All)
and check ONLY
#N/A
.
c. Click OK. Back to the work book, simply highlight the email field containing the value
#N/A
and delete.
До:
![введите здесь описание изображения](https://i.stack.imgur.com/iOQo5.png)
После:
d. Either turn off your filter, or go back into filter settings and recheck
(Select All)
and now instead of nasty looking
#N/A
s all over the place you'll have clean looking empty spaces.
(Очевидно, что с такими маленькими таблицами вышеизложенное кажется немного непрактичным, но НАСТОЯЩИЕ книги, с которыми я работаю, содержат тысячи записей, поэтому эти приемы оказались очень кстати)
Надеюсь, это поможет другим в будущем! Пожалуйста, оставляйте любые комментарии или альтернативы или предложения, обратная связь всегда приветствуется! :)
person
cassidymack
schedule
30.07.2012