The INDEX() formula syntax is: INDEX(array, row_num, [column_num]) In your formula:=C2-INDEX($E$2:$G$350,MATCH($A2,$E$2:$E$350,0),MATCH($B2,$F$2:$F$350,0))Your second MATCH() function is comparing the value in column "B" (Size) tothe values in column "F" and returns the row number as if it were a column number! So, when looking for (7), it is found in the first row, so it returns a value of (1)to the index() function.MATCH($A2,$E$2:$E$350,0) also returns row 1.so your index() function looks like:INDEX($E$2:$G$350, row=1, column=1)which, when looking for GM1-Black, returns "GM1-Black" instead of a number! it's even more evident when you get to GM2-Blue in row 5 (4th row of data)looking for (10) in column "F" returns row 4.INDEX($E$2:$G$350, row=4, column=4)returns a #REF! error because columns E:G is only 3 columns. you cannot return column 4. I think the logic of this formula is flawed.you seem to want to subtract the qty in "G" from the qty in "C" when A=E and B=FBut using MATCH($B2,$F$2:$F$350,0) is going to get the FIRST occurrence when B=F,not the one corresponding to when A=E.I think you're better off adding a "helper" column and concatenate E and F like:=E2 & "_" & F2 (in column H)then use :=C2-INDEX($E$2:$G$350,MATCH($A2&"_"&$B2,$H$2:$H$350,0),3) or put =E2 & "_" & F2 in column D and use:=C2-VLOOKUP(A2&"_"&B2,D:G,4,FALSE) Paul----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley -----------------------------------------
On Tuesday, March 1, 2016 3:22 AM, Izhar <izharra...@gmail.com> wrote: Please see the attachment, in the file I'm subtracting G2 from C2 with the formula, can anyone tell me where I'm making a mistake Thanks in advance -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.