Generate Distinct List and Sum On Conditional VLookUp - arrays

Sample Data Sets
I'm trying to write a formula that can fill in revenue amounts in Table3. What I need is for it first to search through Table1 and return an array with each unique ID referenced by the domain.
So for a.com it would return {1,2,3}.
It would then find the revenue value in Table2 that is associated with that ID.
For the array above it would be {100,200,400}.
It would then sum those values to arrive at {700} which would populate cell H3 or [#[Sum of Revenue]] for "a.com".
I've tried using sumproduct and combining it with variations of
{=INDEX(Table1[ID],MATCH(0,COUNTIF($H$2:H2,Table1[ID])+(Table1[Domains]<>$G$3),0))}
But I'm having trouble at arriving at the full array and not just the first, second, etc. unique value in the array. I also don't know how to end up with the revenue values in the array instead of just the IDs. Any help is appreciated.

This is what ended up working:
{=SUM(SUMIF(Table2[ID],IF(FREQUENCY(IF(Table1[Domain]=[#Domain],Table1[ID]),Table1[ID]),Table1[ID]),Table2[Revenue]))}

Related

How to specify a column field in a calculated field formula when you have the same value evaluated as a count and a sum?

I am using a pivot table to summarize our status of completion of a project. The first value of the pivot table gives me a count of the entries in the spreadsheet column that have a value greater than 0. The next value of the pivot table gives me a count of the total estimated quantities from the spreadsheet. The third value gives me the sum of the entries from the same column of the spreadsheet that the first value uses in the pivot table. The final value of the pivot table is a sum of the total estimated quantities from the same column from the spreadsheet the second values uses for the pivot table.
My current working formula will only evaluate the SUM columns in the pivot table and is the following:
=iferror('Quantities Complete'/'Total Est Quantities',0)
This gives me a percent complete based on the SUM of those two columns from the spreadsheet. These values can differ because the first is a real value and the second is an estimated value. What I want is the below formula which I will put how the data is summarized in parenthesis for simplicity of understanding.
=if('Quantities Complete'(COUNT)='Total Est Quantities'(COUNT),1,iferror('Quantities Complete'(SUM)/'Total Est Quantities'(SUM),0))
This formula would allow me to evaluate if the count of complete items matches the total estimated items, if so the calculated field value is 100% regardless of actual sum values. Otherwise, it gives a percent complete based on sum value which is more accurate because each item can have vastly different values.
How can I refer to the 2 different uses of the columns in a calculated field formula?
I have tried the renaming the column headers to 'Items Complete' and 'Item Values' but the formula does not accept those and gave a parse error. I have tried using the "COUNTA of" or "SUM of" prefix for the column fields. I also tried typing the name as shown when I hover over the value field in the edit window which I tried in these methods: 'Quantities Complete' (Items Complete) and 'Quantities Complete (Items Complete)'. All of these yielded a parse error. I can't share my spreadsheet due to confidentiality requirements, but all I need to know is how to refer to the two different column headers that have the same name from what I can tell.

How do I change my multi criteria Index Match formula in such a way that it sorts results closest to today?

How can do I write an array formula in such a way that both following factors apply:
Results give me the names of sales that have either TRUE OR FALSE next to it in a different column/sheet.
Results are sorted chronologically based on the date that is connected to each sale. Each sale has a different date next to it. This can be found in the same sheet as where the "TRUE OR FALSE" result is displayed. Column with the dates is called "AY:AY". I use an indirect formula to target the correct sheet within the spreadsheet.
I currently only have the first criteria implemented, don't know how to do the 2nd one.
Since the raw data is not ordered I need this to happen when I use the Index Match Array formula. So far I have this formula in my Google Sheets spreadsheet.
=ArrayFormula(iferror(index(indirect("'"&$B$5&" 2023'!c:c");small(if(TRUE=indirect("'"&$B$5&" 2023'!ca:ca");row(indirect("'"&$B$5&" 2023'!ca:ca"))-row(indirect("'"&$B$5&" 2023'!$ca$1"))+1);row(1:1)));""))
I know I could use the Index Array formula below with multiple criteria, but don't know how to implement the date component.
INDEX(indirect("'"&$B$5&" 2023'!c:c");SMALL(IF(COUNTIF(_______)*COUNTIF("true"; indirect("'"&$B$5&" 2023'!CA:CA"); ROW(indirect("'"&$B$5&" 2023'!A:CA"))-MIN(ROW(indirect("'"&$B$5&" 2023'!A:CA"))+1); ROW(indirect("'"&$B$5&" 2023'!A1));COLUMN(indirect("'"&$B$5&" 2023'!A1))
Thanks in advance.
A query like this could help?
=QUERY(INDIRECT("'"&$B$5&" 2023'!C:CA"),"SELECT C,AY WHERE CA = TRUE order by AY")

Filtering Values Produced by an ARRAYFORMULA

I am using an ARRAYFORMULA to extract unique values from a list of names and total up a second column for each of those names.
Here is some example data and the ARRAYFORMULA I am using
Example Data
ARRAYFORMULA in cell E3
=ARRAYFORMULA({{unique(B3:B11)},{sumif(B3:B11, (unique(B3:B11)),C3:C11)}})
What I would like to do is filter out those names where the total number of tokens is zero - i.e. I would like Peter to be filtered out of the list because he has a net total of zero Tokens.
[I'd also like to have Peter, and any others, displayed in a separate list, but I guess if you can help me crack this first part I can help myself crack the second part]
Is there a way I can achieve what I want with a single ARRAYFORMULA? Is there another (better) way to achieve the same result?
I've bashed my head against this for a while so would be grateful for any help
use:
=QUERY(QUERY({B3:C};
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col1)''");
"where Col2 is not null"; )
Query and Filter
=FILTER(QUERY(A2:B10,"select A, SUM(B) group by A"),QUERY(A2:B10,"select SUM(B) group by A") > 0)
You don't need an array formula. The FILTER on the outside of the QUERY takes care of our zero token problem. And the QUERY selects column A and SUM of B and returns the proper names and sums, so that there are no repeating names. We need a second identical QUERY for the FILTER to compare 0s against, Because our QUERY doesn't exist outside of the formula. Every reference you make to the QUERY requires you to perform the QUERY again.

Google Data Studio, how to get a sum of all Max or Min values

I am working with a data set where i have to get Min or Max for different text fields. My dataset can have thousands of rows so below is a simpler example. So I have 3 categories having multiple values and I can put this dataset in GDS to build a table where I select Category as dimention and Value as Max(Value) in metric.
Now I need to see the sum of all those values too. But like the pivot table in excel, the subtotal in GDS shows the Max out of all the max listed above. So instead of 65, it shows 30 in GDS. Is there a way I can get it to show the sum?
To reach the desired result you will need:
Make a data combination, not being necessary to insert a second base, just so that a current base is defined as a data combination.
In the combination use the Category dimension and define the Max Value metric. The combination is only necessary for the metric to be used in the table as a dimension (this is a property resulting from the combination of data).
Configure the table with the Category dimension and Include the metric with the Value sum option. Remember that now Value is the maximum value (as defined in the data combination).
Finally, display the Summary line. And the desired result is obtained

Excel quartile function with variable array criteria (like countif)

hoping someone can help with my Excel query.
I want to use the quartile function (or similar, could use percentile if that's easier). I have data in a column but I want to limit the data I use from that column.
I have job departments in column A, people's salaries in column B (and other data in the other columns e.g name).
I want to use my one main data list (c. 2,000 rows) to pick out the quartiles for the 10 or so depts I have but I don't want to have to make 10 specific lists to calculate the quartile of each dept.
Is there an option to use a countif or similar function so that I can have a drop down list of my 10 depts and depending on what dept I select my summary table will show the quartiles relevant for just that dept?
Thanks
Use an array formula =quartile(if(A1:A1000=C2,B1:B1000),.75) press control + shift + enter after entering the formula. Note: C2 = the department which quartile you are calculating.

Resources