Index Match with 2 columns

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello guys
I need your help to enter a formula in column F in the 2B sheet, so that I can get the correct result. I tried using the vlookup function but it is not giving the right result.
In this workbook, the Invoice numbers are the same in some cases but of a different GSTIN number. I am trying to get the name of the Trade Name in column F where the GSTIN and Invoice number of B2B match with 2B.
Query match 2 columns and get value.xlsx
ABCDEF
5GSTIN of supplierTrade/Legal name of the SupplierInvoice details
6Invoice numberInvoice typeInvoice DateInvoice Value (₹)
729AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
829AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
929AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
1029AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
1129AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
1229AACCM4684P1ZNJanuary1124T081711402R01-08-20179209
1329AACCM4684P1ZNJanuary1124T081711402-TotalR01-08-20179209
14
1533AACCM4684P1ZNSunday1124R02-08-20177680
1633AACCM4684P1ZNSunday1124R02-08-20177680
1733AACCM4684P1ZNSunday1124R02-08-20177680
1833AACCM4684P1ZNSunday1124R02-08-20177680
1933AACCM4684P1ZNSunday1124R02-08-20177680
2033AACCM4684P1ZNSunday1124-TotalR02-08-20177680
21
2229AACCM4681P1ZNAugustGST - 1124R03-08-20172038
2329AACCM4681P1ZNAugustGST - 1124-TotalR03-08-20172038
24
2529AACCM4684P1XXNFebruaryAug - 0817R04-08-20174280
2629AACCM4684P1XXNFebruaryAug - 0817R04-08-20174280
2729AACCM4684P1XXNFebruaryAug - 0817-TotalR04-08-20174280
28
2929AACCM3684P1ZNMarch1124R04-08-20174958
3029AACCM3684P1ZNMarch1124R04-08-20174958
3129AACCM3684P1ZNMarch1124R04-08-20174958
3229AACCM3684P1ZNMarch1124-TotalR04-08-20174958
33
3426AACCM4684P1ZNApril123456R06-08-20175262
3526AACCM4684P1ZNApril123456R06-08-20175262
3626AACCM4684P1ZNApril123456R06-08-20175262
3726AACCM4684P1ZNApril123456-TotalR06-08-20175262
38
3930AACCM4684P1ZNMayGST 0001R07-08-20174280
4030AACCM4684P1ZNMayGST 0001R07-08-20174280
4130AACCM4684P1ZNMayGST 0001-TotalR07-08-20174280
42
4331AACCM4684P1XNJune1124T08R08-08-20172288
4431AACCM4684P1XNJune1124T08-TotalR08-08-20172288
45
4633AACCM4684P1ZNSunday78610R11-08-20174280
4733AACCM4684P1ZNSunday78610R11-08-20174280
4833AACCM4684P1ZNSunday78610R11-08-20174280
4933AACCM4684P1ZNSunday78610-TotalR11-08-20174280
50
5129AXCCM4684P1ZNDecemberGST 0001R12-08-20175198
5229AXCCM4684P1ZNDecemberGST 0001R12-08-20175198
5329AXCCM4684P1ZNDecemberGST 0001-TotalR12-08-20175198
54
5533AACCM4684P1ZNSunday741258R14-08-20174280
5633AACCM4684P1ZNSunday741258-TotalR14-08-20174280
57
5833AACCM4684P1ZNSunday12R17-08-20171030
5933AACCM4684P1ZNSunday12-TotalR17-08-20171030
B2B


Cell Formulas
RangeFormula
A2:A13A2=IFERROR(INDEX(B2B!$A$7:$A$100,AGGREGATE(15,6,ROW($B$1:$B$96)/(RIGHT(B2B!$C$7:$C$100,5)="Total"),ROWS($1:1))),"")
B2:B13B2=VLOOKUP(IF(LEN(D2)<7,VALUE(D2),D2),B2B!$C$8:$E$98,3,0)
F2:F13F2=VLOOKUP(D2,CHOOSE({1,2},B2B!C8:C86,B2B!B8:B86),2,0)
G2:G13G2=VLOOKUP(D2,B2B!$C$8:$F$86,4,0)
D2:D13D2=IFERROR(IFERROR(VALUE(SUBSTITUTE(INDEX(B2B!$C$7:$C$100,AGGREGATE(15,6,ROW($B$1:$B$100)/(RIGHT(B2B!$C$7:$C$100,5)="Total"),ROWS($1:1))),"-Total","")),SUBSTITUTE(INDEX(B2B!$C$7:$C$100,AGGREGATE(15,6,ROW($B$1:$B$100)/(RIGHT(B2B!$C$7:$C$100,5)="Total"),ROWS($1:1))),"-Total","")),"")
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try in 2B!G2:
Excel Formula:
=INDEX(B2B!$F$1:$F$2000,MATCH(A6&D6,B2B!$A$1:$A$2000&B2B!$C$1:$C$2000,0))
To be confirmed using Contr-Shift-Enter, not Enter alone; then copy down
 
Upvote 0
Solution
Try in 2B!G2:
Excel Formula:
=INDEX(B2B!$F$1:$F$2000,MATCH(A6&D6,B2B!$A$1:$A$2000&B2B!$C$1:$C$2000,0))
To be confirmed using Contr-Shift-Enter, not Enter alone; then copy
Anthony47. Thanks. The formula is working in column G. I wanted the formula for column F in 2B sheet (Get names). I tried to edit your formula and use the same in column F but I am getting January in all the rows.
The formula for column G is workin. I had to edit the range as the range in B2B sheet starts from the 7th rows. I tried this in column F
Rich (BB code):
=INDEX(B2B!$B$7:$B$2000,MATCH(A2&D2,B2B!$A$7:$A$2000&B2B!$C$7:$C$2000,0))
Got both right now. Thanks once again.
 
Last edited:
Upvote 0
Got both right now. Thanks once again.
So I understand that you fixed the formula for your need (mine was probably wrong in the part "A6&D6", as I erroneously copied the formula for G6 and not for G2)
Thank you for the feedback
 
Upvote 0
So I understand that you fixed the formula for your need (mine was probably wrong in the part "A6&D6", as I erroneously copied the formula for G6 and not for G2)
Thank you for the feedback
Your formula helped me to get the correct result. Your formula was perfect except for the range which I edited it.
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top