This tutorial demonstrates the key strengths of Excel's INDEX / MATCH function that make it superior to VLOOKUP. You will find a number of formula examples that will help you easily cope with many complex tasks when VLOOKUP fails. Continue reading
by Svetlana Cheusheva, updated on
This tutorial demonstrates the key strengths of Excel's INDEX / MATCH function that make it superior to VLOOKUP. You will find a number of formula examples that will help you easily cope with many complex tasks when VLOOKUP fails. Continue reading
Comments page 9. Total comments: 614
Is there a way to populate a result in a cell matching two columns, looking for a value in column A and populating the corresponding value from column B? For instance I have column A listing 1-90. In Column B I have a dollar amount. I want to have that dollar amount as the automatic result when the same number from column A is typed in another cell. I hope this makes sense! :-)
Hi,
I have one doubt in Index match function with multiple criteria. If we have more than one identical values in the main sheet, it will pull the first found value from the lookup table. Is there any solution?
I have one sheet having Invoice number, amount, Supplier name, Currency. And in the main sheet for different Invoice numbers, same combination of Supplier name, currency and amount is there.
Hello, I am new to Excel and needing to write some formula or vlookup to select the min and the max values of an array like this one:
1 9/8/2017 20:20 x y 16,015.00 16,017.00
1 9/8/2017 20:20 x y 16,055.00 16,057.00
1 9/8/2017 20:20 x y 16,095.00 16,097.00
1 9/8/2017 20:20 x y 16,135.00 16,137.00
2 9/9/2017 15:55 x y 15,815.00 15,817.00
2 9/9/2017 15:55 x y 15,855.00 15,857.00
2 9/9/2017 15:55 x y 15,895.00 15,897.00
2 9/9/2017 15:55 x y 15,935.00 15,937.00
2 9/9/2017 15:55 x y 15,975.00 15,977.00
3 9/10/2017 1:02 x y 15,615.00 15,617.00
3 9/10/2017 1:02 x y 15,655.00 15,657.00
3 9/10/2017 1:02 x y 15,695.00 15,697.00
3 9/10/2017 1:02 x y 15,735.00 15,737.00
3 9/10/2017 1:02 x y 15,775.00 15,777.00
4 9/13/2017 1:26 x y 15,415.00 15,417.00
4 9/13/2017 1:26 x y 15,455.00 15,457.00
4 9/13/2017 1:26 x y 15,495.00 15,497.00
4 9/13/2017 1:26 x y 15,535.00 15,537.00
4 9/13/2017 1:26 x y 15,575.00 15,577.00
Would need to extract the 16,015 and the 16,137 for the cells with a 1 on the first column then do repeat the same for column with value 2, 3, 4...
The values needed to be returned for column with a value of 2 would be 15,815 and 15,977, column with a value of 3 would need to return 15,615 and 15,777......
Thank you very much in advance
Ev
I’m having some difficulty figuring out how to utilize Excel’s reference functions to do horizontal and vertical lookups, where the task is to search for a particular value in a specified row, and return the text value in the header of that value’s column. It seems like a combination of Index & Match would be desired, but I can't figure out a workable syntax that doesn't produce errors.
For example
Column A contains record ID’s. (e.g. 101-200)
Columns B-F contain options (e.g. apples, oranges, pears, etc.)
Cell values contain a 1 for first choice, 2 for second choice, 3 for third choice, blanks for unranked options.
An example of the desired outcome is to lookup a particular id (which would be identified by cell reference or formula, not a fixed row #), find the value ranked 1 in that row (values will not be ordered), and return the name of the option associated with that rank. For example, lookup record 25, find rank 1, return oranges if oranges is the header of the column containing rank 1 for record 25.
Any help would be greatly appreciated. Thank You.
Hi there,
I have a question that I am hoping somebody here might be able to provide some insight. So thanks in advance.
I have a table of values (%'s) as outlined below:
| Decile 3 | Decile 4 | Decile 5
Metric X 25.72 - 28.72 28.73 - 30.38 30.39 - 31.52
Metric Y 18.96 - 24.69 24.70 - 35.23 35.24 - 45.87
Also, I have data(%'s) as follows:
Metric X: 100 / 400 = 25.00. Now, based on this score, this results in the 2nd decile, as referenced above. Assuming that I "freeze the denominator", how much would the numerator (100) have to increase in order to reach decile 5? It would be easy to do some simple algebra to calculate that number.
However, I am trying to come up with an automated way to calculate the number to increase the numerator to achieve a given decile.
*Please disregard "Metric Y" above, but note that I have many metrics with different decile ranges in this table.
I appreciate all input.
Thanks!
**Correction, a 25.00 would result in Decile 1 that is not shown. That is not key, but I wanted to explain since I just caught that mistake.
Hi,
Really need your help.
Trying to create an excel spreadsheet that will help with costing for a construction project.
Column A: Area of task
Column B: Task
Column C: Cost code
I want to match the area and task and for the cell to output the cost code according to the lookup table. I tried to use the formula you have provided above but keep getting "#Value" - what am I doing wrong?
The values I want to match are part of a drop-down list. Is this my problem?
I think I figured out the problem - needed to press Crtl + Shift + Enter. How come we need to do that for this formula?
Is it possible to find answers that DON'T match? I have a list of people who have completed trainings. I can see which trainings they have completed, but I would like to see which ones they have not. I currently have the list of everyone who has completed certain courses, and I have a list of all required courses. I'd like to have a list of each name and the courses still required to be taken. Any suggestions would be helpful!
Hi there,
need help plz, am a beginner and trying to create a small template where I will be calculating price of goods plus GST applied. In description column I will write details of goods, now is there a way where I can apply a filter saying lets say description column is B. GST is applied on everything except food items. I have five items to list i.e.tea, coffee, sugar, creamer and Sweetener. so what formula can I try which will say if these 5 items GST will be 0 else it will be E*5%.
DESC QUANTITY UNIT PRICE SUB TOTAL GST
PILLOW 4 13 52 2.6
SUGAR 3 10 30 1.5
Hi,
I'm sorry, I'm afraid your task is not entirely clear for me. But from what I understand, I believe you may want to check out the following articles that may help you build the formulas:
COUNTIFS - to count the items.
IF - to return 0 or multiply by 5% depending on the COUNTIFS result.
I really hope you'll find those tutorials helpful.
Hi Svetlana, very interesting article. I was looking for how to do it but looking up for a value in a whole 2-dimensional range (matrix) instead of an array. The problem is that MATCH function only works with 1-dimension arrays. Any ideas?
Hi Manuel,
There are a few different ways to do 2-dimensional lookup in Excel. Please see this tutorial for full details: How to do two-way lookup in Excel
I have an array with column headings I am sorting on. Once I find the right column I need to copy all cells below to another location, where the original formula resides. Tried using INDEX and Match but come up with some crazy results. Can I use Index and Match to do this?
I have learned so much via your numerous invaluable articles. Your info has saved me so much time, especially with the more complex data compilation & analysis. I would gladly pay a subscription for all of this information. Thank you & thank you.
I'd like to take this opportunity to get a result from someone who has amazing skills in excel formula but to make everything simple. I had this little problem and this how it goes. Let say from column A1-A3 there is a duplicated info. Example: TB944009 (this is repeated thrice from A1-A3) Now, I have heavy table from my sheet that will certainly get the exact value that I want. My goal is to capture all infos that is equal from my look up value(Even if its different information). I use vlookup and it works out a bit, because every time I drag down my formulas it says N/A however, when you search it manually on the table you'll find it there. I tried to use $ sign(to limit the searching) for them to find all those information that I need. but it did not worked on my end. I hope that some one will share his/her knowledge so I can do my task easily. Thank you.
Hello:
After reading through this section there are some very creative solutions here. Unfortunately after a bunch of failed attempts I haven't quite figured out the correct method for solving mine, and request your assistance.
This problem involves the processing of a transaction log table of stock trade trades (buys and sells). The spreadsheet(s) contains 3 tables (in different sheets) , table 1 contains the transaction log, table 2 contains the symbols of each of the stocks in table 1, and table 3 contains the formulas for summarizing the data for each symbol collected from table 1.
In table 1 there can be many entries for each stock symbol and although most of the data I needed can be collected using Sumif(s). The ones that I am having a problem with is Min and Max.
Can you help with the formula for extracting the Min (or Min) values from the P&L column for each stock symbol using the symbols in table 2 please?
An example of table one is as follows:
A B C D
Symbol O_Price C_Price P&L
1 ABC $10.00 $11.00 $1.00
2 ABC $11.25 $11.85 $0.60
3 ABC $12.25 $11.85 ($0.40)
4 DEF
5 DEF etc.
6 DEF
7 DEF
8 etc.
Table 2
A
1 ABC
2 DEF
etc
Table 3 is the results table containing the summarized values, 1 row per symbol.
Thank you,
Cheech
thnx alot for explanation.
Hi there
tell me about the formula or function that to help me in tax if the tax little difference it not important
like the following example
ADELA 0.5 MCG tab ADELA TAB 0.5 MCG
ADVANT TAB 16 MG ADVANT TAB 16 MG
ADVANT 8 MG ADVANT TAB 8 MG
Hi!
I want to do a simple vlookup as normal. But I have 2 different "sets" I need to vlookup in...
Example:
Maine
Maine
Maine
Virginia
Virginia
Virginia
parts:
x, y & z available at both Maine and Virginia
I want to vlookup usage of X specifically in Virginia
Hi, I have an Excel workbook contains list of PlayStation players, so we merge them manually, then I want to do automatic check on those players name and check their score who win and it will also based on the first winner (maybe based on the time it was inputted) then the the formula should take the player to next level on the table.... The formula I was using before is if statement (=IF(C6>E6,B6,IF(E6>C6,F6))) so I discovered that some people don't play their game according to how we fix them, please what can I do to achieve this ...... The criteria I want to follow is this***check column c4:c200&e4:e200 the last inputted cell should and check the highest score, it should move the last player if the highest score is from column c or from column e
i would like to know if I will be able tp us e the match and index command to look at two rows one beneath each other to match if a number is the same between the two rows in each cell.
Once the match is found, can it then copy the two cells from each row to another cell
Thank you
Raj
A B C D
1 Name Date Issue Quantity
2 Sultan 15-03-16 Book 4
3 Rehman 16-5-16 Novel 3
4 Zakir 18-5-16 Pen 18
5 Sultan 19-5-16 Eraser 14
6 Zakir 20-5-16 Novel 8
I want that I just give a name in a cell and it show Complete Record in this sheet as like this.
Zakir
Zakir 18-5-16 Pen 18
Zakir 20-5-16 Novel 8
Wow, amazing articles!
How did you learn this all?
Thank you, Jenny! Just read a lot, practice a lot, and work with colleagues who know a lot more :)
hie help me on this one, which would I use to rank students using index match. One student is being dropped if they are sharing the same position. for example
Table 1
STUDENT NAME MARKS POSITION
MIKE RICHARD 560 1
CARLO JONES 555 2
RUTH TONEY 555 2
BRIAN JAMES 552 3
I want the formula to give me results as shown in table 1 above but instead I am having results as indicated below in table 2 with 1 student missing on the list
Table 2
STUDENT NAME MARKS POSITION
MIKE RICHARD 560 1
CARLO JONES 555 2
RUTH TONEY 555 2 - (missing on the list)
BRIAN JAMES 552 3
which formula should I use to have all students on the list even those sharing the same pos
Hi Svetlana,
I am trying to create a list of items not shipped out from our facility.
I have a workbook with 6 pages. Each pages represents one size of cylinders we are shipping. Each cylinder has numbers in numerical order listed down columns on the page.
Example:
RJ001
RJ002
RJ003
etc.
Each row of the cylinders has information like customers name, date ordered, order number, etc.
One column in the row I enter the "date shipped". I am struggling to create a summary page that will list ALL cylinders from ALL pages that has no "date shipped" filled in. I am just looking to list the cylinder numbers on the summary page which has the "date Shipped" column not filled in. Then when I fill it in, it will be removed from the list. Am I looking at the right formula for this or am I aimlessly struggling for nothing? Any help would be appreciated. :)
Hi,
I have data in a worksheet like
Date Line absent %
8-Jan-17 A-1 7%
9-Jan-17 A-1 6%
10-Jan-17 A-1 3%
I want to get this data in another worksheet, where I will enter date and line name then the absent% will come automatically. Could you please help me ?
Hi Svetlana,
This is an excellent blog! Could you please help me with this question? Using the Sample Data below, what formula(s) could I use to lookup the Product Number and find all of the Product Names assigned to that Product Number? (Please see Expected Results below depicting how I'd like to summarize the results from the Sample Data.)
Sample Data
Product Number Product Name
111 Zoloft
111 sertraline
222 Advil
222 ibuprofen
222 Motrin
333 Advair
444 amoxicillin
444 Amoxil
555 APAP
555 Tylenol
555 acetaminophen
666 Vimovo
Expected Results of the Formula(s)
Product Number Product Name
111 Zoloft, sertraline
222 Advil, ibuprofen, Motrin
333 Advair
444 amoxicillin, Amoxil
555 APAP, Tylenol, acetaminophen
666 Vimovo
Thank You,
Reba
Thanks very much for posting this! It helped me potentially hours of work and lowered the chance of making manual errors.
Hi Svetlana,
I've spent the entire day on this blog searching for a way to solve the problem given inline and I must say WOW you are an amazing expert :), hope you will be able to help me too with the following problem and advise which formula to use for the following problem:
I have a list of cca. 18.000 customers mixed in cca 100 cities inside one country.
Country is divided by 8 regions where 1 region has cca 7-8 cities under it. I have a separate table/list which cities corresponds to which region.
I need to assign each of the 18.000 customers to a specific region, based on the city they are in.
Logic of the list is:
Column B2:B18001 contains cities names (multiple customers per one city)
Separate table has a list of all cities under one specific region (in total 100 cities divided in 8 regions - with luckily no overlaps or false entries)
I need the formula that will find all cities in column B that belong to these 8 regions and in the column C place a corresponding region name next to the city value (do 'cities per region' division).
So it's all textual data, with multiple 'recognise' and IF 'city1' 'city2' 'city3'..... - THEN 'region 1' and repeat for the 7 other regions.
Can you help me please?
I've been searching for a solution for hours and starting to think that the fastest way would be if I manually do all 18.000 entries :(
Many thanks in advance!
Vila
Hi Vila,
It's definitely not a trivial task :) To make things easier for us to understand, can you send a sample sheet and expected result to support@ablebits.com?
Hi Svetlana,
How do I do this? :
I've given cell N2 a name("myRef") which contains "B5". I wanna be able to write sth like "=2 * DEREFERENCE(myRef)" instead of writing "=2 * B5". What can I write to DEREFRENECE that cell's value?
Svetlana,
Thank you for this post! Very informative and I agree that too many people just rely on LOOKUP functions instead of these two. However, one thing you appear to have left out is when using this with text strings there is a drawback. Special characters break the MATCH function. For instance, if you are matching on a bunch of reason descriptions and one of them has a "/" somewhere in it the MATCH function fails while the VLOOKUP will still match it. This happens even with exact matches.
Thank you,
Alex
How To I Find A Value From A Specific Columns Value?
Ex: Column A1=1, A2=5, A3=10 And Column B1=2, B2=10, Column B3=15. Now I Find Number=10 From A1,A2,A3.
USEFUL
hi there, i believe i can do what i need to with this, however, i'm running into a problem getting it to work out.
I have spreadsheet A and spreadsheet B.
I am comparing spreadsheet A cells C1-C387 for matches against spreadsheet B cells C1-509 and when there is a match I want to return the value of spreadsheet B column D for that particular row/match and have it populate spreadsheet A column D
Does this make sense? Thanks.
Hello,
I need some advice. I have a very large spreadsheet which hundreds of lines where I need to pull information from one column, based on the information in another.
So far I can determine whether the initial column contains text from the range needed using =SUMPRODUCT(--ISNUMBER(SEARCH(($Y$2:$Y$30),A2)))>0 this is good as it identifies the list of rows which are affected, but means that i have to manually pull the information needed.
How do I go about searching a cell for the contents from a series of others and if it is found returning the found information?
Column A "Column B
does Column A contain one of these?" If column A contains data from column B, put the data from column B here
1.0_1234_text text 1234 ??
1.0 5632_text text 7895 ??
1.0_7895_text text 5278 ??
1.0_3568_text text ??
1.0_5278_text text ??
I want to show year-to-date performance for sales people using data from monthly spreadsheets to give me year-to date figures. I used the following:
=INDEX(MONTH1!C$16:C$29,MATCH($B16,MONTH1!$B$16:$B$29,0))+INDEX(MONTH1!C$16:C$29,MATCH($B16,MONTH1!$B$16:$B$29,0))
and so on for 12 months. It works great for all sales people who have been here all year. However if the salesperson does not appear on one or more month's sheets I get the dreaded N/A. Please help :)
Thanks
Hi Experts,
My requirement is : I have two excel sheets with 100 rows in sheet1 and 800 rows in sheet 2. I want to compare the sheet1 data whether is it there in sheet2 and if available that should highlight else ignore.
Please advise if we have any mechanism to achieve this. Thanks for your inouts in advance.
I have a formula of{=INDEX(B236:IN287,MATCH(B7,B237:B287,0),MATCH(B9,B236:IN236,0))} which works up until the 86th column but then returns an N/a when trying to find an answer in the 180 columns to the right.
is there a limit to the number of columns that can be used? I have checked that all is well within the table, no merged cells no numbers as text etc etc
im stuck as to why it doesn't work if you are able to shed any light please?
kind regards
Damion
There are two sheets with the data, I have a requirement to check a column in both sheets and if there is any match then the entire row has to be replaced by the matching cell in the excel.Thanks
Dears ,
please tell me that , by using index/matching how we can find a specific range from a big reference of data ! . I'm having difficult using v lookup because of many raw and columns .
please .
WOW, Thank you, thank you, thank you a million times. It worked.
Thank you for a great tutorial! I was able to get INDEX/MATCH working to auto-fill several different sheets in a document. Thank you for saving me from copy-paste!
Hi Svetlana,
I work with a spreadsheet in Excel that is the product of a CSV export from a web application. The export consists of a number of work tickets, each of which contains, among other things, a field with multiple values separated by commas. The CSV export results in one row per ticket, and it unfortunately creates a separate column for each of the comma-separated values that in reality are part of a single field. I never know ahead of time how many comma-separated values will be contained in the field in each ticket, so I never know how many total columns will be generated in the export, nor how many of the columns will contain a value for any given ticket. What I want to know is the number of values for each ticket.
For example, lets say in each ticket there is a field named "label". For ticket 1, label="car, truck, plane, bus, ship". For ticket 2, label="plane, train". The CSV export will contain five columns with the word "label" in Row 1. Row 2 will have five label values, one value in each of the five columns. Row 3 will have label values in the first two columns, and the remaining three will be empty.
I'd like to add a column with a formula to tell me how many values exist for each ticket. In the above example, the column would look like this.
Number of Labels
5
2
Can you help me with a formula for this?
Any help is much appreciated.
Dave
Hi Svetlana,
I need your help.
I have a table with 3 columns contaiin Location name, Latitude and Longitude. I want to find a lat,lon for given location from above table. I used following formula to obtain it.
INDEX(N3:N416,MATCH("Anuradhapura",M3:M416,0))
The problem is lookup_value which is location name creates while joining 4 cells. Instead of writing location name within brackets, I want to give it as a function.
Then above formula does not work.
INDEX(N4:N417,MATCH('S (1)'!B550&'S (1)'!C550&'S (1)'!D550&'S (1)'!E550,M4:M417,0))
please help me to overcome this problem.
Hi Roshan,
To help you better, we need a sample table with your data in Excel and the result you want to get. You can email it to support@ablebits.com. Please add the link to this article and your comment number.
Hi, can someone help me, I have spent 3 hours trying to find what formula I need.
I have 3 columns, 550 rows of data. Column A contains 25 options, Column B contains a 22 options for each of the options in column A, column C contains a number.
I have done 2 dropdown lists for Column A & B. what i need is a formula to look at what i have selected in the cells that have the list and bring in the number from column C.
Please help, Thanks
Hi Collin,
You should use the following array formula:
{=INDEX(C1:C550, MATCH(G2&H2, A1:A550&B1:B550, 0), 1)}
The dropdown lists are in G2, H2.
To enter this formula press CTRL+SHIFT+ENTER.
Hi Svetlana,
I need your help. I am in Recruiting.
In recruiting a potential candidate would pass through different stages (sourced-> not suitable/reject/voice message-> submitted-> interviewed -> offered-> hired).
The current ATS displays a single candidate at multiple stages (which gives me inaccurate report)
What I need is to be able to pull proper report with total unique sourced candidates, not suitable candidates, voice messages etc.
I need your help, if it is possible to have excel create a hierarchy system, where excel can pick one option (Interviewed), in case 2 or more options available (sourced, interviewed, left voice message etc).
And this needs to be multiple criteria, as I would be lining them against different job IDs.
Thanks
Subash
Hi Subash,
Please show us how your data looks like.
Good day Svetlana
I have data in several columns, the most important are 6 columns
1.Each set of data has unique number in column 1 (unique number start from 1 to …)
2.Each unique number has a set of rows with identical description in column 2 (Comm. Payable x 2 rows, Funding Charges – this can be multiple rows, Trade Payable or Trade Receivable)
3.Each unique number amount of items in column 3 (amount in only 1 row, same row Trade Payable or Trade Receivable from column 2)
4.Column 4 and 5 are buying price and selling price respectively – on same row with Trade Payable or Trade Receivable from column 2
5.Column 6 has profit & loss. Each description in column 2 rows has a value in this column
# Description Items Buying Selling P/L
86 Comm. Payable 0 0 -5
86 Trade Payable 709 0.485 0.439 -32.61
85 Comm. Payable 0 0 -5
85 Trade Payable 1740 0.345 0.315 -52.2
85 Funding Charges 0 0 -0.06
86 Funding Charges 0 0 -0.04
85 Funding Charges 0 0 -0.06
86 Funding Charges 0 0 -0.04
86 Funding Charges 0 0 -0.03
86 Funding Charges 0 0 -0.05
86 Comm. Payable 0 0 -5
85 Comm. Payable 0 0 -5
I want to change the descriptions in column 2 rows to be column headers, in a way that each unique number will now have only one row with summation of descriptions
# Buying Selling Items Funding Charges Comm. Payable P/L
85 0.485 0.439 709 -0.12 -10 -52.2
86 0.345 0.315 1740 -0.16 -10 -32.61
Thank you
Ron
Hi Ron,
Please try to do the following:
1. Add the additional column G in your table with the following formula:
=IF(COUNTIF(A2:A13, "="&A2) = 1, A2, "")
Now you have only unique values for column A in column G.
2. Add the additional columns with the following formulas:
=SUMIF(A2:A13, G2, C2:C13) - to sum the Items column
=SUMIF(A2:A13, G2, D2:D13) - to sum the Buying column
=SUMIF(A2:A13, G2, E2:E13) - to sum the Selling column
=SUMIF(A2:A13, G2, F2:C13) - to sum the P/L column
3. Remove the blank rows to get the results.
Hello Svetlana,
Your tutorial is absolutely great. Thank you very much.
Hi all,
i need to sort the B no. column datas with respect to the A no. column datas, (both columns are text format)
Hi Jinson,
Please try to do the following:
1. Select the range with your data - A1:B100 for example.
2. Select the Data ribbon tab and click the Sort button.
3. Select the Column A in the Column.
4. Click OK.
I want formula for following condition.
If age >22 then Basic*60% else if age =16 and less than 22 then basic*50% and if age=11 then basic*40% and if age=6 then basic*30% and age<=6 then basic*20%
Regards
Rajaraam
Hi Rajaram,
You should use the following formula:
=IF(A1>22, B1*1.6, IF(A1>=16, B1*1.5, IF(A1>=11, B1*1.4, IF(A1>6, B1*1.3, B1*1.2))))
The age values are in Column A, the base values are in Column B.
I want formula for following condition.
If age >22 then Basic*60% else if age =16 and less than 22 then basic*50% and if age=11 then basic*40% and if age=6 then basic*30% and age<=6 then basic*20%
i don't know if this is relevant, but i have 5 cells that all have a "=IF" function in so it will look at a cell and return "TRUE" or "False" value.
what i want to do is, have it look at all 5 cells that were returned and number for the "TRUE" cell
cell values are
A2 = False
B2 = False
C2 = True
D2 = False
E2 = False
then i want it to look at all 5 cells and return a number for the "TRUE" cell so the result must be "3" for this example
the numbers that will be assigned to the cell will be
A2 = 1
B2 = 2
C2 = 3
D2 = 4
E2 = 5
how would i do this?
Hi Marius,
You should use the following formula:
=MATCH(TRUE, A2:E2, 0)
Is there a way to autofill the array INDEX/Match Formula? I've created the formula in row 4 and need to drag it down and autofill though 2000 rows. Thank you in advance!
Hi chris,
Please look at the following article, it should help:
https://support.office.com/en-us/article/Fill-data-automatically-in-worksheet-cells-74e31bdd-d993-45da-aa82-35a236c5b5db