Index match formula with condition of only returning first match

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
929
Office Version
  1. 365
Platform
  1. Windows
I am needing help with an index match formula. The formula has 2 matches and returns one value, however I would like it if one out of the 2 matches only returned a value on the first match and left all other matches blank.
=IFERROR(INDEX(INV[Fee''s and Taxes],MATCH(1,([@line]=WO[[#Headers],[BARREL]])*([@[Inv Number]]=INV[Invoice '#]),0)),"") - The portion in Bold to only return the first match

See below spreadsheet example, any help would be greatly appreciated!

Example2.xlsx
ABCDEFGHIJKLMN
1ProjectInv NumberlineProject SubtotalBARRELSTILLInvoice #Fee's and TaxesWhat I want results to look like:
21111177125BARREL10.3287.13 7712587.13BARRELSTILL
32222277125STILL70 87.137045215.3887.13
43333370452STILL75.24 15.389523113.4187.13
54444470452STILL1.29 15.3815.38
65555570452STILL167.5 15.38
76666670452STILL82.5 15.38
87777795231BARREL229.3213.41 
98888895231STILL495 13.4113.41
109999995231STILL434.5 13.4113.41
11
Sheet1
Cell Formulas
RangeFormula
E2:E10E2=IFERROR(INDEX(INV[Fee''s and Taxes],MATCH(1,([@line]=WO[[#Headers],[BARREL]])*([@[Inv Number]]=INV[Invoice '#]),0)),"")
F2:F10F2=IFERROR(INDEX(INV[Fee''s and Taxes],MATCH(1,([@line]=WO[[#Headers],[STILL]])*([@[Inv Number]]=INV[Invoice '#]),0)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,

Maybe like this? You can drag the formula in [E2] to the right.
Book1
ABCDEFGHIJKLMN
1ProjectInv NumberlineProject SubtotalBARRELSTILLInvoice #Fee's and TaxesWhat I want results to look like:
21111177125BARREL10.3287,13 7712587,13BARRELSTILL
32222277125STILL70 87,137045215,3887.13
43333370452STILL75.24 15,389523113,4187.13
54444470452STILL1.29  15.38
65555570452STILL167.5  
76666670452STILL82.5  
87777795231BARREL229.3213,41 
98888895231STILL495 13,4113.41
109999995231STILL434.5  13.41
11
Sheet1
Cell Formulas
RangeFormula
E2:E10E2=IFERROR((COUNTIFS(WO[[#Headers],[Inv Number]:[Inv Number]]:WO[@[Inv Number]:[Inv Number]],WO[@[Inv Number]:[Inv Number]],WO[[#Headers],[line]:[line]]:WO[@[line]:[line]],WO[[#Headers],[BARREL]])=1)*INDEX(INV[[Fee''s and Taxes]:[Fee''s and Taxes]],MATCH(1,(WO[@[line]:[line]]=WO[[#Headers],[BARREL]])*(WO[@[Inv Number]:[Inv Number]]=INV[[Invoice '#]:[Invoice '#]]),0)),"")
F2:F10F2=IFERROR((COUNTIFS(WO[[#Headers],[Inv Number]:[Inv Number]]:WO[@[Inv Number]:[Inv Number]],WO[@[Inv Number]:[Inv Number]],WO[[#Headers],[line]:[line]]:WO[@[line]:[line]],WO[[#Headers],[STILL]])=1)*INDEX(INV[[Fee''s and Taxes]:[Fee''s and Taxes]],MATCH(1,(WO[@[line]:[line]]=WO[[#Headers],[STILL]])*(WO[@[Inv Number]:[Inv Number]]=INV[[Invoice '#]:[Invoice '#]]),0)),"")

Using a custom format to "hide" the zeros:
Rich (BB code):
#.##0.00 , , ""
 
Upvote 0
Hi,

Maybe like this? You can drag the formula in [E2] to the right.
Book1
ABCDEFGHIJKLMN
1ProjectInv NumberlineProject SubtotalBARRELSTILLInvoice #Fee's and TaxesWhat I want results to look like:
21111177125BARREL10.3287,13 7712587,13BARRELSTILL
32222277125STILL70 87,137045215,3887.13
43333370452STILL75.24 15,389523113,4187.13
54444470452STILL1.29  15.38
65555570452STILL167.5  
76666670452STILL82.5  
87777795231BARREL229.3213,41 
98888895231STILL495 13,4113.41
109999995231STILL434.5  13.41
11
Sheet1
Cell Formulas
RangeFormula
E2:E10E2=IFERROR((COUNTIFS(WO[[#Headers],[Inv Number]:[Inv Number]]:WO[@[Inv Number]:[Inv Number]],WO[@[Inv Number]:[Inv Number]],WO[[#Headers],[line]:[line]]:WO[@[line]:[line]],WO[[#Headers],[BARREL]])=1)*INDEX(INV[[Fee''s and Taxes]:[Fee''s and Taxes]],MATCH(1,(WO[@[line]:[line]]=WO[[#Headers],[BARREL]])*(WO[@[Inv Number]:[Inv Number]]=INV[[Invoice '#]:[Invoice '#]]),0)),"")
F2:F10F2=IFERROR((COUNTIFS(WO[[#Headers],[Inv Number]:[Inv Number]]:WO[@[Inv Number]:[Inv Number]],WO[@[Inv Number]:[Inv Number]],WO[[#Headers],[line]:[line]]:WO[@[line]:[line]],WO[[#Headers],[STILL]])=1)*INDEX(INV[[Fee''s and Taxes]:[Fee''s and Taxes]],MATCH(1,(WO[@[line]:[line]]=WO[[#Headers],[STILL]])*(WO[@[Inv Number]:[Inv Number]]=INV[[Invoice '#]:[Invoice '#]]),0)),"")

Using a custom format to "hide" the zeros:
Rich (BB code):
#.##0.00 , , ""

Works perfect! Thank you :)
 
Upvote 0
Most welcome :). Thank you for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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