Looping Vlookup with INDEX - excel

I am trying to write an excel function/combination of functions that will loop without the use of macros.
I have one table with two columns and another table with 4 columns. The only important columns are the first two.
I need a function that searches through the first column of the top table and finds all materials on line 51. Material codes that are on rows with line numbers that match 51 will then be placed into the line 51 table below the first table.
NB: the first table (the one with data) will most likely never be sorted so I can not make my life easier via sorting... This first table will also be changing as it is fed from an add in excel program. I must not use macros/VBA as it needs to be sustainable for the average excel user to comprehend. I've tried nested IFs inside VLOOKUPS and many combinations of formulas, I am thinking INDEX is the way to go but I can't find a way to use INDEX to reach my desired goal.
**Even though the Line column contains some multi-lines ex 8/9, these will be non-factors as my formula should only look for a specific line, 51.

This formula should work:
=IFERROR(INDEX($B$2:$B$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-1)/(ISNUMBER(SEARCH(G2,$A$2:$A$6))),ROW(1:1))),"")
It is an array formula so limit the reference range to the extents of the dataset.

Related

Excel automatically sort column of numbers

I am looking to automatically sort a column of numbers in descending order without touching the sort button, or VBA.
Unfortunately I am trying to achieve this in a work environment where I have no access to VBA and excel is not one of the latest versions that contains the new SORT function in 365.
It is quite literally a column of numbers, and the numbers are automatically updated as they are totals of rows of smaller numbers elsewhere, and these change based on something else - so this specific column will always change numbers, but I need the column to automatically keep on top of sorting numbers by descending order.
I tried using rank.eq and some other bits with adding a 1 to each row to avoid duplicates, but this buggered it up if more than two duplicates was found. Is there anything I can do at all? Even if it involves going a very long way round it and building extra tables and things etc.
Grateful for any help.
It'd be easier to see your data and without being able to use a spill range, it's impossible to know how many rows. I also think you're intending to use LARGE function rather than RANK.
If you had your numbers in column A, you could drag the following formula down the appropriate number of rows to get the numbers sorted... (starting in cell B1)
=LARGE(A$1:INDEX(A:A,COUNTA(A:A),1),ROW())
If you can get your numbers in a table, you could use a similar formula but the table would ensure the appropriate rows exist (assume table name is Table1 and note the column names of RawNumbers and Sorted). Put this in Sorted Column:
=LARGE([RawNumbers],ROW()-ROW(Table1[[#Headers],[Sorted]]))
I presume using a pivot table is not a viable option... but these are how you could accomplish your objective of sorting by formula.

Dynamic Excel Function to Identify Row Number without VBA

So I am attempting to create a static table in Excel that functions dynamically based off of a pivot table. The amount of data is manageable, ~200-300 rows, so having the formulas wrapped in IFERROR to keep them blank is not an issue. The issue I am running into is identifying the row number that the subtotal's are populated in. They are split by client but the number of entries can very month to month so this month the subtotal for client A could be row 46, but next month it could be row 52. The data is needed from the subtotal line to perform additional calculations within the "static" table.
So far I have been able to concat the row function, which correctly identifies that there is 1 row containing the data.
=ROWS(CONCAT(VLOOKUP(G47,Table1[[CWShortID]:[Company Name]],2,FALSE)," ","Total"))
However, I am unable to pull back the row number itself (which I need to concat into another formula).
Essentially I am attempting to use a short id to pull the clients full name from another table, concat it with " Total" to form the search parameter, return the row number of the match, then concat that with a column identifier to perform the intended calculation. Example:
=SUM(I47/IF(COUNTIF($A$52,CONCAT(VLOOKUP(G47,Table1[[CWShortID]:[Company Name]],2,FALSE)," ","Total"))=1,$B$52,""))
Basically in the above I need both "52"'s to be dynamically populated by the function. Reading Microsoft's documentations ROW() appears to be what I am looking for, but when nesting it doesn't work as intended.
=SUM(I47/IF(COUNTIF(CONCAT("A",ROW(CONCAT(VLOOKUP(G47,Table1[[CWShortID]:[Company Name]],2,FALSE)," ","Total"))),CONCAT(VLOOKUP(G47,Table1[[CWShortID]:[Company Name]],2,FALSE)," ","Total"))=1,CONCAT("B",ROW(CONCAT(VLOOKUP(G47,Table1[[CWShortID]:[Company Name]],2,FALSE)," ","Total"))),""))
Anyone ever been able to do this without having to write in VBA routines or functions? I would prefer to stick strictly with Excel formulas.

Excel copy function with rotation

I have a spreadsheet with two portions, the first's rows are usernames and columns are data types (availability, ID, email etc), the second's rows are the data types and columns are the usernames. The second's values must be calculated based on what is in corresponding cells in the first. The second isn't simply copied from the first, each cell contains calculation based on multiple columns of the first portion.
I have been asked to keep these as they are currently, as in don't just create new new columns in the first portion or rotate the second.
So my question is: is there a way that I can copy a function across columns in a way that the variable changing by column is the row number not the column number?
I know the thing I'm trying to do makes no sense. Makes no sense to me neither, but this is what I've been asked to do.
Ended up using a whole bunch of INDIRECT(ADDRESS(MATCH, MATCH)) functions to get the values then get the desired values from them into the second portion.
A second table or extra column would've been so much cleaner but hey, to each their own.

Lookup values in an unknown range - Excel

Is there any way to look up and display the latest value in a group that does not have a set range?
Here's a breakdown of a question. I am working with some data that I like to break into data groups that can be collapsed. On a weekly basis I un-collapse the group and insert a line at the bottom with the new information. I would like that latest bit of information to be automatically displayed on the top cells that is displayed when collapsed.
I have used look-up tables and I have a function that I used for testing purposes: =LOOKUP(2,1/(C5:C11<>""),C5:C11) that obtains the last cell within that designated ranged: C5-C11.
Now can I do something similar within grouped data values that have no defined range?
One way to do this is with an index function, assuming that there are no other rows of data on this worksheet other than the group that you're trying to find. Here's an example of a formula that could work for you. It assumes that your data starts in K2 and you want to have your result in K1.
=INDEX(OFFSET(K2,,,ROWS(K:K)-ROW(K2),1),MATCH(9.99999999999999E+307,
OFFSET(K2,,,ROWS(K:K)-ROW(K2),1)),1)
The offset creates an array for all cells below k1 without counting k1. The match function searches for the largest number possible, this formula assumes that you're looking for numbers. If you're looking for text, or a combination, you'll have to use a different formula by replacing the match portion with:
MATCH(REPT("z",255) 'for text
MAX(MATCH(9.99999999999999E+307,range),MATCH(REPT("z",255) 'for numbers and text
Source: http://www.techonthenet.com/excel/questions/last_value.php

How to sanitize a collated column with text and numeric data to make it uniform for easy analysis in excel 2007

I have 3 column heads and I wanted to collate it with 3 similar heads from another sheets. 10% at an average from each of the 6 columns is blank, I have to map the data based on these 3 columns to other data and I need them to be sanitized. So there are the blanks and then there are some cells which have text like 208110185726A570-14. Please help.
Haven't heard back from the comment above, but I'll have a go at this anyway (and will be using assumptions that may be incorrect):
Given that you have included the tag vlookup, I'm assuming that you want to build a table that uses the leftmost column as an index of unique values to conduct a VLOOKUP. If that's the case, I don't see any way around blank cells in the leftmost columns in the two sheets, other than saying that the ensuing VLOOKUP would skip over any row that had a blank leftmost cell.
If you can live with that, the way I would go about it is pretty simple:
Copy the columns from one group (omitting the header row) and paste them to the end of other group. Again, since you have mentioned VLOOKUP, I'm assuming that keeping the cells in the rows next to each other is the goal (i.e. you can't remove the blanks in the columns because otherwise that would mess up the horizontal integrity of the cell relationships).
Do your VLOOKUP. Again, I'm assuming unique values in the leftmost column. This assumption is important, because it will make a difference to the decisions you make about what type of VLOOKUP you use (range vs. exact match) and what value is returned. For example, if you use exact match and there are repeating values, it will return the 1st match it finds.
Again, the assumptions might be wrong, but the question is a little unclear.

Resources