Return Array of SUMPRODUCT Results - excel

I am trying to merge the contents of tables, rank them, and return the results as an array so that, eventually, values can be found with INDEX or VLOOKUP. I'm on a work network. I am stuck with Excel 2013 without PowerQuery and macros are a hard no. I am trying to avoid hidden sheets and helper columns. I have managed to successfully combine the output of tables into a single array, but am having trouble accomplishing getting a ranking of each item into an array.
Here is the sample workbook I'm using to do a proof of concept:
https://1drv.ms/x/s!AmnV99KYATO-g5kxvJBpTSSjF_XBXw
Everything is currently on just one sheet, but the goal is to eventually link tables from multiple sheets or even workbooks together and have the results automatically aggregated in a table that is both sortable and filterable. I'm trying to end the endless Ctrl+C and Ctrl+V I currently do to aggregate data.
For readability, most of the formulas in the workbook have been turned into named arrays. I have the last few steps broken out so you can see where I am stuck. The components of the named array RANKED only return a single digit, not an array of 24 values like the COMBINED formula. When I Ctrl+Shift+Enter my final RANKED array I get the expected result, but when I do VLOOKUP and INDEX I get errors because RANK only returns one value. You can see in the table on the right VLOOKUP fails after the first row.
I am using SUMPRODUCT instead of COUNTIF because (as far as I know) COUNTIF cannot take arrays as input. There is then an offset so that the ranking works like RANK.EQ. Does anyone know how to accomplish what I am trying to do or am I attempting the impossible?

Related

Excel - Replicating a SUMPRODUCT formula with already summed up values

I have a sheet that uses the below formula to arrive at a figure:
=SUMPRODUCT(E12:K12,E23:K23)/M10
To my understanding, it's getting the sum of E12:K12(593+622+636+620+595+583+589) and multiplying that together with the sum of E23:K23(5740+5160+5432+4640+4716+7372+6696); then dividing the result by M10(39,756).
I have 2 new cells that contain the results of the two summed ranges but when I try to replicate the formula with a regular sum, the result is different:
=SUM(IntradayPlan2!D346*IntradayPlan2!D347)/P12
The result should be 604 but it's coming out at 4383. P12 contains the same number as M10 and the 2 cells in the SUM are summing the same values as the original SUMPRODUCT formula is.
For clarity, I'm currently replicating the main sheet a second time to generate this result. It's slowing down the workbook and most of the other detail on the replicated sheet isn't needed, so I'm trying to get rid of it.
I'm sure I'm missing something when it comes to SUMPRODUCT but after an hour of Googling around I can't work it out. Is there a way of replicating the same maths procedure with my new totals instead?
After the great explanation by Gowtham I don't think it's possible to recreate the result of a SUMPRODUCT by using total values of the 2 used arrays.
Those cells actually get their values from another sheet, which I need to keep anyway. So I've created a couple of new rows which puts those figures in a line (their otherwise spread out across the sheet) and have referenced those new groups instead.
=SUMPRODUCT(IntradayPlan2!D355:J355,IntradayPlan2!D356:J356)/O12
And I'm getting the expected result :)

VLOOKUP and INDEX return #N/A when referencing another LOOKUP cell

I'm working on an Excel 2010 worksheet that uses a table that references a secondary table to generate a list of values.
More specifically, I have two tables: Table_Players and Table_ChallengeCalc. In Table_Players, I have the columns Players, Experience, and Level. I input the total number of points that a given player has under the experience table, and using this formula the level column tells me what level the player is:
Table_Players:
=LOOKUP(C6,
{-1;0;300;900;2700;6500;14000;23000;34000;48000;64000;85000;100000;120000;140000;165000;195000;225000;265000;305000;355000},{"0";"1";"2";"3";"4";"5";"6";"7";"8";"9";"10";"11";"12";"13";"14";"15";"16";"17";"18";"19";"20"})
Table_ChallengeCalc resides on a different sheet in the workbook, and references the Level value in Table_Players to pull a list of additional values from another table, Table_Difficulty.
Before I implemented the above lookup formula, I was just manually inputting the player's levels and in turn, the Table_ChallengeCalc was pulling the correct values for the remaining columns, using this to load the player's assigned level on Table_Players:
Table_ChallengeCalc:
=VLOOKUP([Players],Table_Players[Level],3,FALSE)
(Here's what it looks like when it works correctly):
However, as soon as I added the first LOOKUP value, the second VLOOKUP immediately became #N/A and in turn, so did all of the rest of the reference columns. If I remove the first lookup and manually enter the level again, the VLOOKUP immediately starts working again. I tried using a nested INDEX/MATCH statement, but it had the same results. As long as I'm using that first LOOKUP, Table_ChallengeCalc can't seem to pull the level value.
If I didn't know any better, it would seem to me that the workbook is trying to run the VLOOKUP simultaneously, if not immediately prior, the LOOKUP formula. Any ideas on how I can counter this, or is this one of those things where I've kind of hit the limitations of what an Excel workbook can do without additional software like VBA?
If I understand your issue correctly, then using the following formula should work for you:
=VLOOKUP([Players], Table_Players, 3, FALSE)
You currently have this in your table_array: Table_Players[Level], but your "[Level]" column is coming from the col_index_num: 3 in the formula, so you should not include this in your table array.

Print the results of a vlookup to a cell in excel

I have been working on a solution to this problem for a few hours now and I am basically no where except knowing that I don't know how to do it...So here goes.
I want to take the original data that I have in Excel that have 'code#s' for each 'category#'. With those 'code#s', I can look up the 'category#' name.
This has been so challenging because there are a varying number of categories for every 'title#'.
I have tried printing the 'category#' name next to 'title#', but it is seemingly impossible because Excel goes through every row in the original data and gives a True, False or #N/A instead of selecting and printing only the true statements without copying down a thousand rows. I want it to go through all the possibilities and only select the categories based on the criteria that they have the same 'title#' and their lookup code matches somewhere in the lookup table.
Thanks if you can offer any sort of help.
Here are some of the formulas I have tried:
IF(AND($M$5=TOP_TREND_CONTRIBUTORS!$W$2:$W$253,MATCH(TOP_TREND_CONTRIBUTORS!$A$2:$A$253,'Category Lookup'!$D$3:$D$30,0)<>"#N/A"),TOP_TREND_CONTRIBUTORS!$A$2:$A$253,FALSE)
....where M5, W:W is the 'title#', A:A is the code for the lookup-in that part I am trying to say that they are valid if the code registers in the lookup table and the 'title#s' are equal. The last part I am trying to get it to print the 'code#s' that are valid. But that only works when I drag the formula down all the rows.
Maybe I'm missing something, but I just tried to get from your original data and lookup table to the final result. I used VLOOKUP to put categories next to titles and then used pivot table to present the data in the way you wanted (after changing some settings of pivot table and fields). Is that what you need? (some words are in Polish, it doesn't matter).

How to cope with more than 100 IF statements

I am creating an checklist using an array of checkboxes in MS Excel 2007. Based on the number of checkboxes, there are 2^7 (=128) possible combinations in which the checkboxes can be selected. Each combination of checkboxes selected gives a unique outcome.
What would be the most efficient way to successfully test for each condition, and give a result in a cell in a worksheet?
Example code:
=if(and(chkbox1=true,chkbox2=true,chkbox3=false,chkbox4=false,chkbox5=true,chkbox6=false,chkbox7=true),"Unique outcome",if(and(chkbox8=true,chkbox9.............)))))))))
The method I have (unsuccessfully) attempted is to use IF statements. I have attempted to bypass the nested IF limit by creating 14 named ranges with approximately nine nested IFs each, and compile the 14 named ranges in a valid nested IF within the spreadsheet. Unfortunately, the processor is struggling to calculate the outcome of this (i.e. computer is "freezing").
Would reducing the number of nested IFs in the named ranges (but increasing the number of nested IFs in the spreadsheet) have an influence on efficiency?
Would it be better to use nested IFs in cells rather than named ranges?
Would VLOOKUP work?
At the moment, I am contemplating using VBA code as people have said that it would be the most efficient way to approach numerous conditions. Does anyone have any suggestions or recommendations?
String together a 1 or 0 for each TRUE or FALSE result then create a lookup table with a column for each possible binary value and another column for the outcomes (or rows rather than columns).
To expand on pnuts's answer, you could achieve this with a formula such as:
=if(chkbox1=true,1,0)+if(chkbox2=true,2,0)+if(chkbox3=true,4,0)+if(chkbox4=true,8,0)+ ...
This will give you a value between 0 and 127 which you can then use in a VLOOKUP function to get the appropriate result from a two column table (or more simply, in an OFFSET function to get the appropriate result from a single column list).

How are Google Sheets array formulas different from Excel (count until sum reached)

I'd like to know which column is the last column where the sum of the values of the row is smaller or equal to a given value. (Count the columns until a sum is reached.)
In Microsoft Excel the following array formula works just fine:
{=MATCH(7;SUBTOTAL(9;OFFSET(C1;;;1;COLUMN(C1:G1)-COLUMN(C1)+1));1)}
But Google Sheets always returns 1 as an answer:
=ARRAYFORMULA(MATCH(7;SUBTOTAL(9;OFFSET(C1;;;1;COLUMN(C1:G1)-COLUMN(C1)+1));1))
Is there some difference between Excel and Google Sheets array formulas that I'm missing?
If there is a difference is it documented somewhere?
Is there another way to implement this in Google Sheets (preferably without custom functions)?
Link to sample spreadsheet.
Is there some difference between Excel and Google Spreadsheet array
formulas that I'm missing?
The difference is how specific functions are supported in array formulae. In this case, you're out of luck on two counts: OFFSET can't be iterated over an array (ie it can't produce an "array of arrays" as it can in Excel), and the second argument of SUBTOTAL can't be iterated either; in Sheets, it must be an explicit range.
If there is a difference is it documented somewhere?
No, not that I know of.
Is there another way to implement this in Google Spreadsheet
(preferably without custom functions)?
=ArrayFormula(MATCH(7;SUMIF(COLUMN(C1:G1);"<="&COLUMN(C1:G1);C1:G1)))

Resources