Excel 2010 index match - multiple criteria - excel-formula

I am new to using index/match, and I'm facing some trouble. I have two worksheets, one with table act and the other with table wa. act contains 7,199 rows; wa has 25,099 rows.
I am trying to match order number and date in order to pull a document number from wa onto act. The order numbers will be an exact match, but the date on act is slightly less than the date on wa.
My formula is:
=INDEX(WA[BillingDocumentNumber],(MATCH([#[Customer PO Number]],WA[PO],0)+MATCH([#[GL Posting Date]],WA[CostPostedOn],-1)))
Depending on how I sort the wa data, I have gotten the following results:
494 document numbers returned (sometimes correct; sometimes pulling from the cell in wa directly beneath the cell that should be returned) with the rest #N/A;
approximately 1400 document numbers (all incorrect, I think) with the remaining being either #N/A or #REF
Can anyone help me? I have no practical knowledge of VBA, but I am the resident Excel "expert" (seems funny to me) in my company, so I am the person who is faced with the task of solving this problem... I have combed the existing forums, but I haven't found any that seem to provide a (non-VBA) solution for my problem. Any ideas would be greatly appreciated!
Thank you for your time.

Here is my untested proposed solution:
{=CONCATENATE(IFERROR(IF(AND(WA[PO]=#[Customer PO Number],WA[CostPostedOn]>#[GL Posting Date]),WA[BillingDocumentNumber],""),""))}
Entered as an Array Formula using CTRL + SHIFT + ENTER.
This will return in one text string all results that match the PO number and in which the act date is older than the wa date. You can modify your second and add a third conditional in the AND to create date ranges (ie WA[CostPostedOn]>=#[GL Posting Date]+7 or WA[CostPostedOn]<=#[GL Posting Date]-7).
As you are using arrays though there might be some performance issues when you scale this to 7,000+ formulas. Sadly you can't do a VLOOKUP with 2 conditionals.
Hope this helps. Cheers,

Related

Simplifiy and make an more efficient Excel Formula

I have been continually adding in complexity to my formulas to accomodate the large amount of data. I have been trying to simplify this excel formula but cannot seem to find a way that works well. I would appreciate any advice!
{=IFERROR(IF(INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),4)="Complete",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2),IF(VLOOKUP([#SN],FullSNList_2,8,FALSE)="None",IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" "),IF(OR(VLOOKUP([#SN],FullSNList_2,8,FALSE)="Dev",VLOOKUP([#SN],FullSNList_2,8,FALSE)="ECO",VLOOKUP([#SN],FullSNList_2,8,FALSE)="Rework"),IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" "),IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" ")))),"_")}
A little more info on the code. It is meant to scan a table and search for a step name (DOC###). Depending on other criteria's (if one column has none, rework, or broke, in it) spaces are added to the end to differentiate between them while being able to still be counted at a later step. Also, if a step is being done for the 2nd time, a period will be added afterwards.
I have been putting the formula in http://excelformulabeautifier.com/ to help read it a bit easier!
UPDATE: I have Modified the formula a bit and added explanations. The new code has replaced the old one in the body. I have attached pictures to show my explanation.
Formula Explanation PG 1
Formula Explanation PG 2
Example Data output
NOTES: In order for this to work for me, due to the circular references, I turned on Iterative Calculations and set the Max iterations to 2.
Removing the VLookups from the formula made the calculation time a lot shorter! Thank you all for your ideas! Any other suggestions are greatly appreciated!

Index Match Match query Excel 2013

Good day.
I am having some difficulties inserting an Index Match Match formula into Excel 2013, and I can't for the life of me work out where I have gone wrong.
I have a data table (as seen in the screenshot). On the left hand column I have a list of sites; across the top I have a list of weeks, with the table filled with sale predictions. I basically want to bring through the sales predictions For a specific named site and week in rows 22 and 23, and the formula I have is:
=IF(ISERROR(INDEX(B2:AO20,MATCH(B22,B3:B20,0),
MATCH(B23,C2:AO2,0))),0,INDEX(B2:AO20,MATCH(B22,B3:B20,0),MATCH(B23,C2:AO2,0)))
All the is being is returned is a 0 value; without the error handling, all it returns is a #N/A!.
Is anyone able to advise me or point me in the right direction at all please?
Screenshot is hopefully below
Screenshot
Perhaps protect this with an ISERROR statement, but otherwise this should work:
=vlookup(b22,$b$2:$ao$20,match(b23,$b$2:$ao$2),false)
Although instead of protection (or as well as) I'd make the site and week cells into validated lists

Excel match multiple records from timetable

I just stuck with my school homework, it seems easy, but there is always different errors and mistakes.
Context
All I need is to connect information from 3 pages.
The first one is timetable of trainings.
The second page is "groups"
Players page
Question
1) Here is my first question. How I can put the time from the "timetable" page ?
I tried vlookup with the easiest group "children 5-7" but even this doesnt work.
The problem is that there is many possible times of some groups and I need the answer like "17:00, 18:00 etc" then.
2) The second question is with the page "players".
Firstly I need to match group or coach from page "groups". For children all is simple, but excel dont want to work even with this. But, there is one problem more. In adult group there cant be more than 4 players in one group, that why I have TK1, TK2, TK3 and TK4 - all this are for adult A. and TK11, TK22 etc are for adult B. So when its done we should match court and time from page "groups".
There is my spreadsheet so be free to try it right here. Hope you will help me!
Ref
https://docs.google.com/spreadsheets/d/1PNp60xmHOx_Q1wBc33WrzIaWmeNG5UMhi-4roV7dJXU/edit#gid=1868650910
I try to give you some ideas about how to solve your issues
Question 1:
The issue you have with VLOOKUP is that you cannot search on the left of your lookup value in the reference table. As suggested above by BruceWayne, you may use INDEX/MATCH. Considering the structure of your data a good formula could be:
=INDEX('timetable try here'!B:G,MATCH(A2,CHOOSE(B2,'timetable try here'!C:C,'timetable try here'!D:D,'timetable try here'!E:E,'timetable try here'!F:F,'timetable try here'!G:G),0),1)
In fact I am using CHOOSE() to select the column where your case should match, because your courts are numbers from 1 to 5. You may replace this formula in the column D under the label Time in your sheet named "groups try here". By the way the result that you get is only the first occurrence (in case you see a zero with some decimals figures, remind to change format to hours), so you will not be able to get the list as you like. As far as I know Excel does not have such kind of formulas. What you could do is create a VBA formula by yourself. You can find more details in this other post always here in StackOverflow, where I replied to a similar question with some code. I believe that your case is exactly the same.
Question 2
In this part I just added the last argument to the VLOOKUP and your formula works. So the correct formula should be in cell E2 of "players try here":
=VLOOKUP(D2,'groups dont try here'!A2:C15,3,0)
and in cell F2 (Court) of the same sheet:
=VLOOKUP(D2,'groups dont try here'!A2:C15,2,0)
I believe you need also a formula to pick-up the time in cell G2 (time):
=VLOOKUP(D2,'groups dont try here'!A2:D15,4,0)
These formulas of course works with suitable groups starting with "children". For the others it is not very clear to me what you need. If you have grouped all TK in Adult A and Adult B you need to have some criteria to fill in the other cells from your sheet 'groups dont try here'. Also remind that if you recode the TK1 and TK2 (for instance by adding a new column to be used as key for the VLOOKUP), with VLOOKUP you will always pick up only the first occurrence in the table.
If you need more support, please leave a comment.

Sum up cells based on conditions

I appreciate this could be treated as a simple question. I have been trying to figure out where I'm going wrong as I'm sure it is something simple ... from the Strategy Exposures tab you can see that his strategies are either macro or tactical I have a table (below) and have been asked to to sum up the required exposure for Macro and for Tactical depending on what is there. I want to create two separate cells. One which adds up 'Macro', and the other which adds up 'tactical'.
Strategy ExposureDescription ExposureRequired (USD)
EUR_MACRO DAX INDEX 2,000,000
EUR_MACRO FTSE INDEX 4,000,000
EUR_MACRO CAC40 INDEX 1,100,000
EUR_MACRO S&P INDEX 10,000,000
JPY_MACRO NKY INDEX 4,000,000
JPY_MACRO S&P INDEX 34,000,000
USD_TACTICAL S&P INDEX 4,000,000
JPY_TACTICAL NKY INDEX 6,000,000
JPY_MACRO S&P INDEX 3,000,000
Currently, I have tried variations of: =SUMIF(B$3:B$11,"*MACRO*",D$3:D$11)
however this formula keeps giving an output of 0. Table ranges from (diagonally) B2 - D11.
So it turns out after all of this, the SumIF function was working okay when we created a new workbook with brand new data. This prompted me to close down the current sheet which I was having formula issues with, disable the macros and re-try. It worked a charm. I have never experienced this before however as #brucewayne suggested, their must've been some conflict based on one of the macros. Unsure what yet, will look into this and see if I can figure it out. If I do will post more. Hope this helps someone.

Automation of Subtotal range picking

For my internship I am trying to do an analysis of travel patterns in public transport.
Due to privacy reasons I cannot share the file, but I may describe the columns.
This is how it works.
I have a spreadsheet in Excel (2007) and it is called ReizigersData. That contains 15,000 rows of checkins.
The columns are: stopname, stopID, problemStop, D, E, productname, workday, saturday, sunday.
stopID can be seen as a primary key.
As you'll understand, the stops are repeated in several rows, because many different productgroups travel from the same stop.
Using a Advanced filter I have filtered out 3 relevant productgroups, reducing it to approx 300 rows.
The other sheet in the file is called ReizigersData (bundled).
In this sheet I want to get the subtotals per stop, combining the numbers of the three productgroups, although separated by workday/saturday/sunday.
This sheet contains the following columns: stopname, stopID, workday, saturday, sunday.
I have used the following codes:
In ReizigersData (bundled) stopname:
=INDEX(ReizigersData!$A$3:$A$14326;MATCH(B3;ReizigersData!$B$3:$B$14326;0))
In ReizigersData (bundled) stopID:
=SUBTOTAL(109;'ReizigersData (2)'!G174:G205)
These codes work.
The problem though is that I entered that range by hand.
Since it is a big database, I would like the subtotal formula to automatically determine which range he should pick according to the stopID in the bundled sheet.
I have experimented a bit and came up with this formula:
=SUBTOTAL(109;(INDIRECT("'ReizigersData (2)'!G" & Match(B3;'ReizigersData (2)'!$B$3:$B$14326))):(INDIRECT("'ReizigersData (2)'!G" & Match(B3;'ReizigersData (2)'!$B$3:$B$14326))))
Unfortunately this does not work; it returns 0. In Formula evaluator, it looks that the reference in the match part is the issue, because it refers to row 2297, which is not the one it should be.
Has anyone got any idea how to reach my goal?

Resources