Dynamic Excel Function to Identify Row Number without VBA - excel

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.

Related

Excel Macro to perform a formula where one column has the same value in several rows

I can't quite find the right code example to do what I'm looking to do.
We have an excel file with data from a project where a request can have several TASKs associated with it and different teams or organizations can be assigned. I'm trying to create a summary of whether the request was worked on by one team or another or "jointly" worked on (based on more than one team/org being assigned to tasks under the same request).
Here is the example and the result I'm looking for:
I want the code to be able to loop thru all rows checking where column A (request #) is the same value and builds an array of the value contained in column B (Team assigned) for each row where A has the same value. Then some sort of function to determine if the values in the array contain more than 1 team. If all of the TASKs were worked on by one team, just that team is the result, if more than one team worked on TASKs, the it results with "Joint".
This can be done without VBA, using formulas.
For the Result column in my screenshot, column E, I used
=IF(COUNTIFS([request],[#request],[team],[#team])=COUNTIFS([request],[#request]),[#team],"Joint")
The same formula without structure references reads like this:
=IF(COUNTIFS($B$3:$B$22,B3,$c$3:$c$22,c3)=COUNTIFS($B$3:$B$22,B3),E3,"Joint")
Apply the formula to the whole table column. If you don't want to use structured references, make sure to use absolute references for the column ranges, i.e. $B$3:$B$22 etc.
The Pivot table has Request and Result in the row areas, and the Tasks in the Values area. A pivot table needs to be refreshed when new data is added.
A dynamic result table can be achieved with the new dynamic array formulas available in Office 365 versions of Excel.
In H12 and I12 of my screenshot I use
=UNIQUE(Table1[request])
=XLOOKUP(H12#,Table1[request],Table1[Result])
The formula automatically spills down as far as required.
So, no VBA required, which means you can save as a regular .xlsx file, which will also run perfectly fine in the browser and on mobile devices.

Return all matches in columns using one criterion (from drop down on another sheet)

I am having two tables, one table (table 1) below is main data, separated into many columns and blocks per 10 rows in one, as you can see A2:A11, A12:A21 and so on (many rows and columns) ... In Column A are unique numbers, but one number per block as a unique, and all other information in other columns can differ, sometimes will be more data sometimes not. The data is always same structured.
What I am looking is to have report / printable sheet where I will have all my columns on one sheet, but in a Column A2 for instance drop down list that will use all unique numbers from main data table and populate all matches on report page, same as it is on picture below. There are many columns that should work automatically when I choose something from "Number" drop down. The trick here is, there must be 10 rows per block also, I have organized it as it should be, but I can't figure out how to populate using functions. So, you can imagine clicking one drop down and getting those lists updated without scrolling endlessly through columns and rows on main data table...
Where I have a problem is that I am getting matches only for first rows but not whole rows (or all rows where matches are) ...
using this function:
=INDEX(Table1[Datum];SMALL(IF(Table1[Nummer]=Printable!$A$2;ROW(Table1[Nummer])-ROW(INDEX(Table1[Nummer];1;1))+1);1))
If someone can help me out, I would be happy!
Try below formula. After putting formula to cell drag down and across as needed. I have tested this formula in Excel2013 and with range (not as table). So, you have to adjust formula for table. I suggest you to first test the formula in single sheet like my screenshot and if it is successful then go for table in Report sheet.
=INDEX(INDEX(B:B,MATCH($G$2,$A:$A,0)):INDEX(B:B,MATCH($G$2,$A:$A,0)+9),ROW(1:1))

EXCEL: Searching a table of data with two criteria and outputting the rows to a new table

I have a table of data (Data!$A$8004:$F$10430) within an excel sheet which I need to search for all of the rows that contain the date displayed in cell: Data!Q27 (e.g may-2017) in column F of the table of data. And then output in a new table all of the rows which match that specific date (Data!Q27 changes, but is always in the MMM-YYYY format)
I created a similar solution for another table which worked, however for this data table it is not working. The working solution is shown below:
=IF(ISERROR(INDEX(Data!$A$1:$K$7523,SMALL(IF(RIGHT(Data!$A$1:$A$7523,7)=Data!$Q$25,ROW(Data!$A$1:$K$7523)),ROW(1:1)),1)),"",INDEX(Data!$A$1:$K$7523,SMALL(IF(RIGHT(Data!$A$1:$A$7523,7)=Data!$Q$25,ROW(Data!$A$1:$K$7523)),ROW(1:1)),1))
(This differs slightly as the date format in the table and Data!Q25 is /mmm/yy, but it successfully creates the new table which changes values dependent on the value in Data!Q25)
The format of the date in column F is e.g 09-May-2017 and is classified as 'general' type.
I have used this formula, and I get no error or value on the cell that this code is on:
{=IF(ISERROR(INDEX(Data!$A$8004:$F$10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8
)=Data!$Q$27,ROW(Data!$A$8004:$F$10430)),ROW(1:1)),1)),"",INDEX(Data!$A$8004:$F
$10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8)=Data!$Q$27,ROW(Data!$A$8004:$F$1
0430)),ROW(1:1)),1))}
The formula is formatted as an array, and therefore I believe this code should work, returning the first A column value of a row which fits the criteria of having, for example: "***May-2017" in its F column. However it doesn't.
Unfortunately due to corporate protection I am unable to share the spreadsheet, but if the information supplied in this isn't clear enough I could supply a new excel sheet to show my example?
https://drive.google.com/open?id=1NpS0_Bsy8XuicrPl8oy5tAswEa9QZ9X2 <- here is a spreadsheet that I have recreated to show the issue. The real spreadsheet is different, but this shows the purpose of my problem. Regardless of there being values which should be picked up on the tab names 'Data for normal user', no data is shown.
Thank you for your time!
Your formula is correct, however you haven't offset the rows.
Your INDEX() is starting at row 8 so this will be the first indexed row. SMALL() is building an array of the exact row numbers so row 8 in SMALL() is row 1 in the index, therefore no results are showing.
You simply need to update the IF() within SMALL() to handle this offset: (This formula has been updated to respond to formula dragging, i will include your original after)
=IFERROR(INDEX(ConfidentialLiveData!A$8:A$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$A$14)-7),ROW(1:1))),"")
Or
=IF(ISERROR(INDEX(ConfidentialLiveData!$A$8:$J$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)-7),ROW(1:1)),1)),"",INDEX(ConfidentialLiveData!$A$8:$J$14,SMALL(IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)-7),ROW(1:1)),1))
A quick tip for error handling formulas is to use F9 when highlighting sections of your formula to show what that is calculating. For example i highlighted IF(RIGHT(ConfidentialLiveData!$F$8:$F$14,8)=ConfidentialLiveData!$C$2,ROW(ConfidentialLiveData!$A$8:$J$14)) and saw that that calculated as {8;FALSE;10;11;FALSE;FALSE;FALSE} so the match was being found just that the row numbers being returned were not what we were looking for.
Update:
So your formula is starting on row 8004, that row in the index is row 1. To get that row returned you need to take away 8003 from the 8109 to give you the 106th indexed row. A common way to do this is to take away the starting row and add 1 which in your original formula would be: {=IF(ISERROR(INDEX(Data!$A$8004:$F$10430,SMALL(IF(RIGHT(Data‌​!$F$8004:$F$10430,8 )=Data!$Q$27,ROW(Data!$A$8004:$F$10430)-ROW(Data!$A$8004)+1)‌​,ROW(1:1)),1)),"",IN‌​DEX(Data!$A$8004:$F $10430,SMALL(IF(RIGHT(Data!$F$8004:$F$10430,8)=Data!$Q$27,RO‌​W(Data!$A$8004:$F$1 0430)-ROW(Data!$A$8004)+1),ROW(1:1)),1))}

Looping Vlookup with INDEX

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.

formula that matches against multiple dates and grabs the most recent

I have a data table with two columns. The first column has a list of Project IDs, and the second column has a bunch of dates associated with those projects. A project can have multiple dates associated with it.
I would like to create a separate summary table of two columns. The first column will be a list of unique Project IDs (I've been able to do this with an index/match function). I want the second column to search the dates column and identify the most recent date associated with each project.
Is it possible to create this second column of my summary table using standard excel formulas and without using any VBA? After an hour or two, I'm not convinced that this is possible.
I was hoping that, for a given project ID, there might be a way to do the following:
--> identify the row numbers for all rows that contain a given project ID;
--> use this row number information to grab the corresponding cell values from the dates column (presumably by first constructing a list of cell references)
--> display the max date out of those that are returned.
What my spreadsheet looks like
The AGGREGATE¹ function can quickly calculate a pseudo-MAXIF function.
In E2 as a standard formula,
=AGGREGATE(14, 6, (B$1:INDEX(B:B, MATCH(1E+99,B:B)))/(A$1:INDEX(A:A, MATCH(1E+99,B:B ))=D2), 1)
Fill down as necessary.
Like the SUMPRODUCT function, AGGREGATE benefits from referencing the minimum number of rows necessary. The MATCH(1E+99,B:B) truncates each column referenced by the INDEX function at the extents of the daes in column B.
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.

Resources