Excel Index match with multiple criteria? - excel

I have 2 worksheets, Home and Data.
Data:
Column A Column B Col C Col D Col E Col F
ABC2 121 - ABC2 121 ABC2 3456 12/12/2016 =WeekNum(E1) - SPAM
123420121601 - 2678 123420121601 1234 2678 18/12/2016 =WeekNum(E2)
628428121601 - 9862 628428121601 6284 9862 21/12/2016 =WeekNum(E3)
Column A contains random text and a PO number and item no, e.g. the PO of ABC123456781011 would be 123456781011 and the item number would be 2678.
I am extracting the PO number into column B.
In Column C i am getting the first four digits of the PO, this is the supplier number.
In column D i have my item number. This is also extracted from the cell in column A.
The date in column E is also extracted from the PO e.g.
123420121601 = a date of 201216 but converted as date.
Note cell A1 contains no PO and is considered a SPAM row. i do not want/need to use it in anyway so it must be disregarded.
Next
Home:
Column H Column I Col J Col L
1234 2678 18/12/2016 123420121601
6284 9862 51 628428121601
I am trying to use an index match in col D that will give the PO number from my data sheet where the supplier number, item number and date match.
However, on the home sheet in column J, on the last row - a user has input a week number rather than the actual date. I still want to be able to return a PO value if either the date matches exactly or if the week number for that date matches.
Here's what i have so far but the index match is not checking my criteria properly and i am getting an incorrect result. It gives me a result from the PO of the first row on sheet data.
=INDEX(Data!B:B,SUMPRODUCT(IF(YEAR(Home!$J10)<2016,(Data!F:F=Home!J10),(Data!E:E=Home!J10))*(Data!C:C=Home!H10)*(Data!D:D=Home!I10)*ROW(Data!B:B)))
Please can someone show me where i am going wrong?

Related

How to match up 2 columns with 2 other columns

In column A I have product id's and column B has the number of times the product in column A was quoted.
In column C I have the same product id's (but in different order) and column D has the number of times the product in column C was actually sold.
I want to match them up to add a final column in order to divide sales/quoted in order to get a value of efficiency in sales.
I believe it's an index/match/match but I'm not sure how to set it up.
Please help
Try
=B3/vlookup(A3,C:D,2,false)
In words: take the value in B3 and divide it by the value from column D where column C has the same text as A3.

excel extract 6 digits from number, format as date and match with index match?

I have the following 2 worksheets.
Data:
Column B Column C Column D COLUMN E Column F
329115121601 3291 5555 =Date (MID(B8,9,2),MID (B8,7,2),MID (B8,5,2)) 50 <---- Week Number from date
I am trying to extract 6 digits from my number value in Columb B '151216' and want to put this into column E. The 6 digits represent a date which is 15th December 2016.
I am using mid to try and get the number and then date to try and format this as 15/12/2016 - however it's not working. Instead I get 15/12/16.
On my other sheet, 'Home' i am trying to look up the number from column B on sheet 'Data' using an index match (array formula) where the values in column C, D and E or F match.
Home:
Column H Column I Column J Column K
3291 5555 15/12/2016 or Week 50 {=IFERROR(INDEX(Data!$B:$B,MATCH(1,(Home!$H10=Data!$C:$C)*(Home!$I10=Data!$D:$D)*(IF(Home!$J10<55,Home!$J10,WEEKNUM(Home!$J10))=Data!$F:$F),0)),"No Po Found")}
The user should be able to enter either week number or a specific date and get a result.
For some reason, this formula works if the user enters a week number, but not if they enter a specific date. I'm not sure if this is a format issue with the date on sheet 'data' or with the index match formula. Please can someone show me where I am going wrong? Thanks
Excel defaults to 1916 when I input your formula, try adding "20"& to the start of the year parameter:
=Date("20"&MID(B8,9,2),MID(B8,7,2),MID(B8,5,2))
I think you are doing it well. Just need to format the date.
Right click on the cell that contains the date ( 15/12/16 ) then click on cell formatting option and choose the format you prefer.

Index Match with multiple criteria not working properly?

I have 2 worksheets in an excel workbook.
Data
Column A Column B (PO) Column C (Supplier No) Column D (Item No) Column E(date) Column F (week no)
123406121601 - 555 =LEFT(A1,12) =LEFT(A1,3) =RIGHT(A1,3) 06/12/2016 =WEEKNUM(A1,21)
I have about about 1000 rows of data like the above.
In column A, each cell contains jumbled information consisting of a PO number and item number.
The PO number is the first 12 digits in the cell in column A, and the first 4 digits contain the supplier number.
The PO also is made up of a date, i.e. 123406121601 = a date of 061016 and once formated = 06/12/2016.
My formula's give the results below:
Column A Column B Column C Column D Column E Column F
ABC123409121601 - 555 123409121601 123 555 06/12/2016 49
On the second sheet, Home, i have the following:
Column A Column b Column C Column D Column E
123 555 06/12/2016 {INDEX MATCH FORMULA}
I am wanting to lookup the po number on sheet 2 where the supplier number, item number and date match - using the formula below:
=IF(C1<>"",INDEX(Data!B:B,MATCH(1,(Home!A1=Data!C:C)*(Home!B1=Data!D:D)*(Home!C1=Data!E:E),0)),INDEX(Data!B:B,MATCH(1,(Home!A1=Data!C:C)*(Home!B1=Data!D:D)*(D1=Data!F:F),0)))
Within this formula I have surrounded 2 index match formula's inside an if statement. This means the user can check for a result/PO Number based on the supplier number and item number and a specific date or the week number that date falls within.
For some reason, this index match works fine if im using static values and keeping my rows of data relatively short. However, for some reason, either by using formulas on sheet 'data' or by having more rows of data - this causes me to get the following result
NA!
Please can someone show me where i am going wrong?

Excel index match: If date week number matches date?

I have 2 excel spreadsheets, sheet 1 and sheet 2:
Sheet 2
Col F (Date) Col G (Item No) Col H (Supplier code) Col I (PO Number)
21/12/2016 12345 123 PO1111
18/12/2016 5555 2468 PO2222
123 po982
Sheet 1
Column F (Week No or date) Column G (Item No) Col H (Supplier Col I (Formula) Code)
51 12345 123
18/12/2016 5555 2468
In Column I on sheet 1, i want to add my index match formula:
=INDEX(Sheet2!D1, MATCH(F4&G4&H4,Sheet2!A:A&Sheet2!B:B&Sheet2!C:C, 0))
This should return the PO number from column I on sheet 2 where column F, G and H match.
This works fine. And from the example above, this formula would return a result for the last row:
18/12/2016 5555 2468 PO2222
You might have noticed that the first row in column (F) on sheet 1 has a week number 50 - yet there is a date of 21/12/2016 in column F on sheet 2.
By rights this would not give a matching result.
However, Column F on sheet 2 will either have a week number or a specific date in it. And if this is the case, i want my formula to check for both a matching date or where a matching date is not found, check if the date falls within that week number? So for instance 21/12/2016 would fall into week 51 (week beginning monday).
Is there a way i can amend my index match formula accordingly to get this result?
Thanks in advance
I added a helper column in Sheet 2 col J to get the week number for the dates in Col F. In sheet1 I used this formula for col I
=INDEX(Sheet2!I:I,SUMPRODUCT(IF(YEAR(F3)<2016,(Sheet2!J:J=F3),(Sheet2!F:F=F3))*(Sheet2!G:G=G3)*(Sheet2!H:H=H3)*ROW(Sheet2!I:I)))
The below part of the formula
IF(YEAR(F3)<2016,(Sheet2!J:J=F3),(Sheet2!F:F=F3))
checks if the year for date is less than 2016. If week number was entered, Year() will return a value of 1900. if true it compares the week number to the col K in sheet 2 else it compares the dates in col F for both sheets.

Identify matching numbers and then imput a value from a different column

I have two sheets, Sheet1 and Sheet2. Sheet1 has a list of company names in column A, Revenue in column B and a unique number identifier in column D (also seen as "unique #forAAA in Sheet2). In Sheet2, I pulled a list from Hoovers, and the format comes up something like below (so this format should not be changed).
Column A B C D
Company Name Place Type of Comp Revenue
1 AAA US HQ 10.0 M
2 unique #forAAA
3 BBB India Branch 5.0 M
4 unique #forBBB
What I'd like to do is match the unique number for each company between Sheet1 and Sheet2 and then put the revenue # from Sheet2 into column B of Sheet1 which corresponds to the correct #. I'm pretty lost here, so any help or ideas would be great. Thanks for your help!
Because the unique identifier is on a different row than the result to be returned, you can use a variation using INDEX and MATCH:
=INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1)
INDEX will return the value within range Sheet2!D:D on row MATCH(D2, Sheet2!A:A, 0)-1.
MATCH(D2, Sheet2!A:A, 0) will give you the row number where the unique ID is found, then -1 to get the row number of the revenue amount.
EDIT: As per comment, to remove the M, you can use this:
=TRIM(SUBSTITUTE(INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1),"M",""))
I would put the unique value in a column inserted before A (would be the new column A) instead of putting it below each row. Then, in the other sheet I'd put the VLOOKUP like this:
=VLOOKUP(D2,Sheet2!A:E,5,0)
That should return the value in column E (column D before the column insertion, i.e. revenue for the unique company identifier).
Note that the third argument in the vlookup function is the number of the column you want to be retrieved, so the range defined in the second argument (Sheet2!A:E) should contain that column.

Resources