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.
Related
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.
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)
The situation: I have an automatic procedure for gathering data from different input-sheets and presenting in a pivot-friendly format. It appears others are in need of the same data, though they want it formatted slightly differently (and they are not friends with excel). I therefor have a version of my table formatted as they want it (with empty columns where my extract does not contain any data).
The table (both) is one line for each department for each year for each cost/income (from now, cost) category. The raw data contains the cost for each year, though some of the users want it to be cost delta from initial year. I want:
One column for raw cost (X). One column for delta cost (Y). One output column (Z) that contains one of those two values, depending on dropdown selection. The first two columns are situated to the right of the "select with mouse and copy these"-columns, so that I dont need to teach the other users how to select non-adjecent columns :P (just letting u know the level of understanding i have to work with here)
Now the naive approach to this would be to have an if-statement in column Z like this:
=IF(selected_Calc="Use raw cost";[#[X]];[#[Y]])
Alternatively nest more ifs (one for "Use difference to 2019", and potentially add more nesting if more ways to show the value should appear in future)
This works. However, it isnt as elegant as I would like it, and if I indeed end up with more ways to calculate this for other people, it will be a lot of nested ifs.
I was therefore considering something like this:
=INDIRECT("[#["INDEX(mapTab_out;match(selected_Calc;mapTab_in;0))&]]")
But this gives a #ref, and tbh i didn't really expect it to work.
The idea is though: .
Have a range mapTab_in. This has the different selections for the dropdown box.
Have the adjecent range mapTab_out. This has the name of the column (X,Y...) that contains the desired calculation)
Have in column Z a formula for selecting which column's (X,Y...) value is to be displayed in Z
The google-stuff I have found so far all seem interested in using the indirect function from outside the table, and usually want to sum an entire column. I have used this in the past. The "ThisRow" things like using # dont seem to work with indirect though. Any ideas, or have I simply made some beginner-error in my formula?
Assuming it's in the same table, you can take advantage of implicit intersection and simply use:
=INDEX(Tablename,,MATCH(selected_Calc,Tablename[#Headers],0))
where selected_Calc is the name of the column you want back. (You could make that the result of a further INDEX/MATCH if you want to use a lookup table for some reason.)
I'm trying to fill in a table using data from another table. I've researched the VLOOKUP function, and either I don't fully understand it, or it isn't the right tool.
For example, let's say I have a column of data that is of the format: (p53, chk2, stra8-cre)
From this column, I want to extract any row (the entire row) that has 'chk2' in it. What tool can I use for this?
Thanks
From what I'm understanding, you're trying to have a formula in one cell that sets the content of all cells in its row. As far as I know, you can't do that without some sort of macro.
My suggestion would be to have a similar formula in each of the rows you want to set.
EDIT:
Use SEARCH to help with this problem. Look here on how to use it for this case.
Ex:
layout in CSV format:
p53chk2,a2,a3
chk2,b2,b3
stra8-cre,c3,c4
formula:
=IF(ISNUMBER(SEARCH("chk2",$A1)),B1,"")
Copy this formula across all cells in the row, and the contentshould be applied the subsequent cells.
Hope this helps, let me know if this isn't exactly what you were looking for.
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