Index Match Query returning incorrect value

trish123

Board Regular
Joined
Apr 6, 2016
Messages
56
=IFERROR(VLOOKUP(B18,Data!$A$1:$U$289,MATCH($C$16,Data!$A$1:$U$1,1)),"")

The above is the query - the issue is that it is returning the incorrect information. The information that is being returned is being pulled is from another sheet where there is a data validation list, but somehow it is not returning what has been chosen, but another item on the list.

When i drag this query down to other cells it only sees the same item on the list?

Anyone any ideas ??
 
Perfect AlanY thank you for all the help, by any chance could you help with the button to save the invoice to a tracker?

glad that we finally got that sorted.
not quite sure of your question re button to save the invoice, are you looking for a macro to export the invoice?

anyway, i'll logging off for the day. I'll have a look tomorrow if you will elaborate a bit further of the requirement.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You truly are a godsend yes currently i have a button for allow user to print the invoice which works fine, but i also want a button to allow the user to save the information input into the invoice to the tracker. Once the user clicks the button the information is then saved to tracker and the information will clear from the invoice to allow the user to create another invoice;

Permissions 2.xlsm
ABCDEFGH
1Invoice NumberNameAddressEvent NumberEvent DetailsDateFacility FeeTotal Amount
20
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Invoice Tracker
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    132.6 KB · Views: 4
Upvote 0
ok. I've a invoice has 5 events (info taken from the data sheet)

Invoice
Customer InformationInvoice Information
NameA N OtherDate23/09/2020
AddressSomewhere1Invoice Number2020-1
Somewhere2Payment Required by Date22/11/2020
Somewhere3
Somewhere4
Site(s)
Event NumberEvent being requestedFacility FeeVat %VAT amountTotal
E-1Filming - Educational1000202001200
E-2Filming - Film1200202401440
E-3Filming - Film1440202881728
E-4Filming - Film172820345.62073.6
E-5Filming - Film2073.620414.722488.32


Staff Member AssignedEvent NumberDepotSiteIF NATIONAL MONUMENT IS NOT LISTED - OnlyDate Request ReceivedEvent Organisers DetailsEvent being requestedEvent Details - If dates are not known enter details hereStart Date of EventEnd Date of Event
BredaE-1TrimJoe WicksFilming - EducationalFilming03/07/202003/07/2020
BredaE-2TrimJohn DoeFilming - FilmChoir Performance17/07/202021/07/2020
BredaE-3TrimJohn DoeFilming - FilmChoir Performance17/07/202021/07/2020
BredaE-4TrimJohn DoeFilming - FilmChoir Performance17/07/202021/07/2020
BredaE-5TrimJohn DoeFilming - FilmChoir Performance17/07/202021/07/2020


and to save it to the tracker like this, am I in the right direction?

Invoice NumberNameAddressEvent NumberEvent DetailsDateFacility FeeTotal Amount
2020-1A N OtherSomewhere1, Somewhere2, Somewhere3, Somewhere4E-1Filming23/09/202010001200
E-2Choir Performance23/09/202012001440
E-3Choir Performance23/09/202014401728
E-4Choir Performance23/09/202017282073.6
E-5Choir Performance23/09/20202073.62488.32
 
Upvote 0
ok, sorry about the late response.
been snowed down at work last few days.

this is the macro I came up with, based on the layout of your excel sheets

VBA Code:
Sub UpdateTracker()
Dim FirstEvent As Integer
Dim new_row As Integer
Dim Events As Integer
'
Application.ScreenUpdating = False
    If MsgBox("Run the update?", vbYesNo) = vbNo Then Exit Sub
    If IsEmpty(Sheets("Invoice").Range("B17").Value) = True Then Exit Sub
'
Sheets("Invoice Tracker").Rows("2:2").Hidden = False
new_row = Sheets("Invoice Tracker").Cells(Rows.Count, 4).End(xlUp).Row
Events = Sheets("Invoice").Cells(Rows.Count, 2).End(xlUp).Row - 16
'
    Sheets("Invoice Tracker").Range("B2:H2").Copy _
        Sheets("Invoice Tracker").Range("B" & new_row + 1 & ":H" & new_row + Events)
    Sheets("Invoice").Range("B17:B" & Events + 16).Copy
        Sheets("Invoice Tracker").Range("D" & new_row + 1).PasteSpecial Paste:=xlPasteValues
    Sheets("Invoice Tracker").Range("B" & new_row + 2 & ":C" & new_row + 1 + Events).Clear
    Sheets("Invoice Tracker").Range("B3:H" & new_row + Events).Value = _
        Sheets("Invoice Tracker").Range("B3:H" & new_row + Events).Value
    Sheets("Invoice Tracker").Range("A" & new_row + 1).Value = _
        Sheets("Invoice").Range("G8").Value
    Sheets("Invoice").Range("B17:B100,D17:E100").ClearContents
Sheets("Invoice Tracker").Rows("2:2").Hidden = True
'
Application.ScreenUpdating = True
End Sub
 
Upvote 0
this is the invoice sheet with the data entered.
note that I'd change G8 for the invoice No as the original formula based on the tracker sheet thus caused conflict

Book1.xlsm
ABCDEFG
1
2
3Invoice
4
5Customer InformationInvoice Information
6
7NameA N OtherDate24/09/2020
8AddressSomewhere1Invoice Number2020-1
9Somewhere2Payment Required by Date23/11/2020
10Somewhere3
11Somewhere4
12Site(s)
13
14
15
16Event NumberEvent being requestedFacility FeeVat %VAT amountTotal
17E-1Filming - Film 11000202001200
18E-2Filming - Film 21200202401440
19E-3Filming - Film 31400202801680
20   
21   
22   
23   
24   
25   
26   
Invoice
Cell Formulas
RangeFormula
G7G7=TODAY()
G8G8=YEAR(TODAY())&"-"&COUNTA('Invoice Tracker'!A:A)
G9G9=G7+60
B16B16=Data!B1
F17:F26F17=IF(E17="","",D17*E17%)
G17:G26G17=IF(E17="","",D17+F17)
C16C16=Data!H1
C17:C26C17=IF(B17="","",INDEX(Data!$A:$U,MATCH(Invoice!B17,Data!$B:$B,0),MATCH(Invoice!C$16,Data!$1:$1,0)))
 
Upvote 0
this is the tracker sheet, before and after the update tracker macro
note that the Row 2 with formula is hidden after first run

Book1.xlsm
ABCDEFGH
1Invoice NumberNameAddressEvent NumberEvent DetailsDateFacility FeeTotal
2A N OtherSomewhere1, Somewhere2, Somewhere3, Somewhere4E-1Choir Performance 124/09/202010001200
3
4
5
6
7
8
Invoice Tracker
Cell Formulas
RangeFormula
B2B2=Invoice!$C$7
C2C2=TEXTJOIN(", ",,Invoice!$C$8:$C$11)
E2E2=INDEX(Data!$A:$M,MATCH('Invoice Tracker'!$D2,Data!$B:$B,0),9)
F2F2=Invoice!$G$7
G2:H2G2=INDEX(Invoice!$B$16:$G$28,MATCH('Invoice Tracker'!$D2,Invoice!$B$16:$B$28,0),MATCH('Invoice Tracker'!G$1,Invoice!$B$16:$G$16,0))


Book1.xlsm
ABCDEFGH
1Invoice NumberNameAddressEvent NumberEvent DetailsDateFacility FeeTotal
32020-1A N OtherSomewhere1, Somewhere2, Somewhere3, Somewhere4E-1Choir Performance 124/09/202010001200
4E-2Choir Performance 224/09/202012001440
5E-3Choir Performance 324/09/202014001680
6
Invoice Tracker
 
Upvote 0
after the tracker updated, the events data will be clear and invoice no increase by 1

Book1.xlsm
ABCDEFG
1
2
3Invoice
4
5Customer InformationInvoice Information
6
7NameA N OtherDate24/09/2020
8AddressSomewhere1Invoice Number2020-2
9Somewhere2Payment Required by Date23/11/2020
10Somewhere3
11Somewhere4
12Site(s)
13
14
15
16Event NumberEvent being requestedFacility FeeVat %VAT amountTotal
17   
18   
19   
20   
21   
22   
23   
24   
25   
26   
Invoice
Cell Formulas
RangeFormula
G7G7=TODAY()
G8G8=YEAR(TODAY())&"-"&COUNTA('Invoice Tracker'!A:A)
G9G9=G7+60
B16B16=Data!B1
F17:F26F17=IF(E17="","",D17*E17%)
G17:G26G17=IF(E17="","",D17+F17)
C16C16=Data!H1
C17:C26C17=IF(B17="","",INDEX(Data!$A:$U,MATCH(Invoice!B17,Data!$B:$B,0),MATCH(Invoice!C$16,Data!$1:$1,0)))
 
Upvote 0
the second invoice as an example

Book1.xlsm
ABCDEFG
1
2
3Invoice
4
5Customer InformationInvoice Information
6
7NameA N OtherDate24/09/2020
8AddressSomewhere1Invoice Number2020-2
9Somewhere2Payment Required by Date23/11/2020
10Somewhere3
11Somewhere4
12Site(s)
13
14
15
16Event NumberEvent being requestedFacility FeeVat %VAT amountTotal
17E-4Filming - Film 42000204002400
18E-5Filming - Film 52200204402640
19E-6Filming - Film 6200120400.22401.2
20E-7Filming - Film 7220120440.22641.2
21E-8Filming - Film 8200220400.42402.4
22   
23   
24   
25   
26   
Invoice
Cell Formulas
RangeFormula
G7G7=TODAY()
G8G8=YEAR(TODAY())&"-"&COUNTA('Invoice Tracker'!A:A)
G9G9=G7+60
B16B16=Data!B1
F17:F26F17=IF(E17="","",D17*E17%)
G17:G26G17=IF(E17="","",D17+F17)
C16C16=Data!H1
C17:C26C17=IF(B17="","",INDEX(Data!$A:$U,MATCH(Invoice!B17,Data!$B:$B,0),MATCH(Invoice!C$16,Data!$1:$1,0)))


Book1.xlsm
ABCDEFGH
1Invoice NumberNameAddressEvent NumberEvent DetailsDateFacility FeeTotal
32020-1A N OtherSomewhere1, Somewhere2, Somewhere3, Somewhere4E-1Choir Performance 124/09/202010001200
4E-2Choir Performance 224/09/202012001440
5E-3Choir Performance 324/09/202014001680
62020-2A N OtherSomewhere1, Somewhere2, Somewhere3, Somewhere4E-4Choir Performance 424/09/202020002400
7E-5Choir Performance 524/09/202022002640
8E-6Choir Performance 624/09/202020012401.2
9E-7Choir Performance 724/09/202022012641.2
10E-8Choir Performance 824/09/202020022402.4
Invoice Tracker


Book1.xlsm
ABCDEFG
1
2
3Invoice
4
5Customer InformationInvoice Information
6
7NameA N OtherDate24/09/2020
8AddressSomewhere1Invoice Number2020-3
9Somewhere2Payment Required by Date23/11/2020
10Somewhere3
11Somewhere4
12Site(s)
13
14
15
16Event NumberEvent being requestedFacility FeeVat %VAT amountTotal
17   
18   
19   
20   
21   
22   
23   
24   
25   
26   
Invoice
Cell Formulas
RangeFormula
G7G7=TODAY()
G8G8=YEAR(TODAY())&"-"&COUNTA('Invoice Tracker'!A:A)
G9G9=G7+60
B16B16=Data!B1
F17:F26F17=IF(E17="","",D17*E17%)
G17:G26G17=IF(E17="","",D17+F17)
C16C16=Data!H1
C17:C26C17=IF(B17="","",INDEX(Data!$A:$U,MATCH(Invoice!B17,Data!$B:$B,0),MATCH(Invoice!C$16,Data!$1:$1,0)))
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,869
Members
449,054
Latest member
juliecooper255

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