Referencing between tables Excel - excel

I am trying to set up a dynamic link between tables in Excel such that I can have a formula that returns who does a task on what day.
The two reference tables are one which lists the task and who is responsible for it, and the second provides a list of dates on which that task is carried out.
this would then feed into the final table:
The idea is that the formula in the final table should check the activity in the first column to return who does the task and also check whether the date in the first row is found for that activity in the second table listing all the dates for each activity.
I can only get so far using
=IF(ISNUMBER(MATCH(date_in_final_table,range_in_second_table,0)),"person","")
which works, but the problem here is I am hardcoding the value for the person. The first two tables could be changed anytime and I would like everything to update automatically.
I guess the answer is going to feature INDEX, MATCH and maybe a look up or INDIRECT, but so far I can't link everything successfully.
Can anyone help please?

Use:
=IF(ISNUMBER(MATCH(date_in_final_table,INDEX(full_range_in_second_table,0,MATCH(activity_in_final_table,title_row_in_second_table,0)),0)),VLOOKUP(activity_in_final_table,first_table,2,FALSE),"")

Related

#VALUE using the FILTER function in Excel

I hear so many good things about the FILTER function in Excel, but I can't seem to get on with it. More often than not I end up with a #VALUE error. I'll usually get to the bottom of it, but this one has stumped me.
This is the formula:
=FILTER(Sheet1[#All],IFERROR((Sheet1[[#All],[Account]]=$D$1)*(Table2[[#All],[Duplicate 21711000]]=0),0))
I've put the IFERROR in because I thought perhaps a bunch of #N/A in the results could be causing an issue.
I've evaluated the Formula, and on the array on the Include side, everything seems to be working perfectly. The Boolean logic has worked, the 1s and 0s are in the right place to theoretically filter my list down to the few records I want to see. But when I click evaluate the final time, and it applies those 1s and 0s to the rows in the array, it results in the #VALUE error, and that's obviously all I can see in the cell.
Any ideas where I'm going wrong?
By the way, the point of this is to help a client who regularly pulls off a report from her accounting system, and then manually filters, copies and pastes the lines for new transactions onto separate tabs on her spreadsheet, over about 30 accounts. My plan is to use Power Query to bring the report into a tab in her spreadsheet, then use the Filter function to bring across the appropriate rows from the Power Query Table into each tab. That's the first criteria here.
I've created another table next to the PowerQuery table which uses a Count If to work out if that line has already been imported. So the second part of the criteria filters the list if the CountIf has registered a duplicate.
I can't just use PowerQuery everywhere, because she needs to then be able to add more columns and manipulate the data once it's been imported. So the final part of the job is to create a macro to copy > paste values, obviously copying the filter function into the row below first, ready for next month.
So Power Query imports all the data, Filter function extracts the specific data into each tab, and Macro locks in that data ready to be edited if need be.
If anyone can think of a better way of achieving the same result, I'm all ears.
So thank you #JvdV, the simple answer was indeed that the two tables were of different sizes, and FILTER requires for them to be the same size.
This caused a follow up issue though that in order to count if I had any duplicates in the sheet, I couldn't go with plan A and use a separate table, because it wouldn't dynamically change it's height when the Power Query table was refreshed.
I looked into maybe incorporating the table into the Power Query in the first place with a custom column. But this would mean that the PowerQuery would end up with 39 additional columns, which would all be brought across by each FILTER function.
So instead I did this. I know this is very niche, so probably won't help anyone, but I'm very proud of myself and want to post it somewhere:
=FILTER(Sheet1[#All],IFERROR((Sheet1[[#All],[Account]]=$D$1)*IF((COUNTIF('21711000 (125006) Int rec'!$C:$C,Sheet1[[#All],[Document Number]]))=0,1,0),0))
(I probably don't need the IFERROR anymore, but it works, so I'm not going to touch it, and it might be safe just in case there ever are any errors).
So this uses the fact that Excel spills now rather than needing specific array functions. Before I made COUNTIF into a separate column, but now I'm putting it in here, and it naturally spills in the background, essentially creating that column within the formula. Then the IF changes any 0 to a TRUE (1), and any other number (my duplicates) to a FALSE (0), and everything works.
It actually creates a circular reference, because the Filter is in column C, but I think that's okay for my purposes, because I don't want it to include the results from the filter anyway. I suspected that might happen, but it seems to be working so far.
I hope that can help someone.

Excel Power Query and Cell refernces

I am looking to have some summary stats for a table that is generated by a query on another tab, but all the approaches I have taken fail for some reason.
Using cell references - COUNTIF(INDEX(Errors!$A$2:$Y$692469,0,MATCH("INCORRECT",Errors!$A$1:$Y$1,0)),TRUE)
With this approach, when the table is generated, the references, even though they are anchored, adjust to the first column that is not part of the generated table.
Using structured references =COUNTIF(Errors[INCORRECT],"True")
This only works if the table already exists with that column. If it doesnt exist, excel wont even let me put in the formula. The formula error dialog pops and I cant save it there.
Creating a table stub that has the columns I want. For instance, I have a table with headers of ID, INCORRECT with one empty row. When I do it this way, the query ends up creating new columns (INCORRECT2) rendering the structured reference worthless.
So, any suggestions? One complexity is that the the table output does not have completely predictable column names. The ones that I want summary stats on are predictable, however, the other ones are not and in fact there could be a single other column or multiple. So that's annoying. I do know what the names (and quantity) of the other columns are. These are established connections.
So the indirect function was the way to go.
=COUNTIF(INDEX(INDIRECT("Errors!$A$2:$Y$692469"),0,MATCH("INCORRECT",INDIRECT("Errors!$A$1:$Y$1"),0)),TRUE)

Returning Specific, Non-Repeating Values

First time posting, though I have lurked around for quite some time.
I am trying to match specific information from a power query created table to another table. The data I am trying to pull can potentially repeat, so it needed to be a formula that would remove that. The current formula I am using is:
{=(OFFSET(Sales!$A$1:$A$100000,SMALL(IF(CONCATENATE($B$48,$O$3)=Sales!$A:$A,ROW(Sales!$A$1:$A$100000)-ROW(INDEX(Sales!$A$1:$A$100000,1,1))),ROW()-48),COLUMN()+2))}
and it was originally working for my test data. Once I pulled the data from the database using power query, however, I continue to get #value errors. The formula looks up a concatenated value on the power query worksheet compared to one created on the current worksheet.
Any advice would be appreciated.

How to inverse VLOOKUP for data entry?

My table has a date column to to the left (Column A). Other columns have share quantities and values. Using standard VLOOKUP, I can retrieve values for a given date.
However: I have new transactions, which regularly need to be added to the master table. What I need is an "inverse" function, that allows me to append (or even over-write) data to the underlying table.
So far, my searches for an "inverse" function only give me alternate ways to retrieve (with the columns out of order). Any suggestions for an appropriate method?
If I understand you correctly, what you are looking for is a script that can add data to the end of a table, or change data on an existing cell. Functions only work by reading data in other parts of the spreadsheet and outputting the result in the cell that they were written in. I don't think you're going to find a formula that sends data to another part of the spreadsheet.
If a script is what you're after let me know. I use scripts like that so I can code a few code snippets.
Please check INDEX MATCH functions.

Lookup Job Code, return column header if cell has text

I'm looking for a little bit of help learning about how to use vlookup and iferror formulas together.
I am working as a licensing specialist within the insurance industry. My job requires that I frequently access more than a dozen spreadsheets that are emailed to us on a weekly basis from our clients. I am working to develop tools that allow us to consolidate that information on-demand to be able to run reports. I'm having no trouble using the VLookup function to pull data from various spreadsheets using an unique identifier. I do need some help, however, with a trickier formula.
I have put together a spreadsheet that allows me to put in the ID of the representative and it returns various bits of information, such as their name, license numbers, job codes, etc. Now I need to come up with a formula that takes the value returned in the job code field and searches another spreadsheet to return what training they are required to complete based on their job code. This spreadsheet is about 2000 rows, and is formatted with the training names spanning across the top row, job codes listed in column "A" and the word "yes" in each column that matches a training that the job code is required to take.
It looks like this: https://i.imgur.com/71COmfF.png
I need the formula in my reports spreadsheet to lookup the job code using VLookup and then return the column header if the cell has text.
The data will be loaded into this spreadsheet: https://i.imgur.com/2CyFURt.png
Here is the Vlookup formula I am using to get the job code:
=VLOOKUP(B3,'.\[Weekly_HR_Report_040615.xlsx]HR'!$A:$Q,10,FALSE)
How can I pair that same kind of formula with something like an IfError formula to return the column header if there is a "Yes" in the cell of the row that matches their job code?
I know that I can work through it as an array using VBA, but I would prefer to just place a formula in each cell so that I can pass this spreadsheet to another college when I move to a different role in the future and they won't struggle too much with adding to it.
Thanks for any help that you might be able to provide! I really appreciate it!
I would use INDEX and MATCH to cross reference and retrieve the titles where applicable:
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),2)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,2),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),3)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,3),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),4)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,4),"")
etc.
I wasn't sure what your reference table is saved as, so you'll need to replace 'JobCode_Training.xlsx'! with whatever the correct path is.
Since you have multiple trainings that can apply to each jobcode, you'll either need to have multiple cells for the results, or you can concatenate them into one.
The following article from excelvlookuphelp.com answers your question I believe...
The Problem
You might be expecting that not all of your search values are going to return something from the search table. Instead of the formula returning #N/A you’d like the result to look different when your vlookup value isn’t found (either blank or an indicator to show that the value hasn’t been found or a zero if you’re wanting to do maths with the results).
The Solution
You can use the iferror function.
It works like this
= iferror (YourVlookupFormula, WhatToSayInsteadOf#N/A)
Here’s an example
=iferror(vlookup(D3,A:C,3,false), “No Value Found”)
Or if you would rather it was just blank then instead of having No Value Found, just have the two sets of inverted commas, like this
=iferror(vlookup(D3,A:C,3,false), “”)
source: excelvlookuphelp

Resources