Populate summary "table" column based on details "table" - excel

I've tried looking up how this might be done, but it's a bit beyond my excel-fu, unfortunately (I could do it in SQL in a snap!).
Basically, in one worksheet, I have the following details "table" (I've included the column and row labels):
A B C D
1 owner name line # run?
2 A A1 10 Y
3 A A1 20 N
4 A A2 2 Y
5 A A2 14 Y
6 A A3 34 N
7 B B1 26 Y
8 B B1 59 Y
9 B B1 193 Y
10 B B1 194 Y
11 B B2 27 N
12 B B2 51 N
and I have the following summary "table" on a different worksheet
A B C
1 owner name status
2 A A1
3 A A2
4 A A3
5 B B1
5 B B2
I need to populate the status column in the summary "table" based on the run? column in the details "table", linked on the owner and name columns.
Here are the results I'm expecting to get, along with why:
A B C D
1 owner name expected status reason
2 A A1 Partial There are Y and N values for owner=A and name=A1 in the details table
3 A A2 Complete There are only Y values for the owner=A and name=A2 in the details table
4 A A3 Not Started There are only N values for the owner=A and name=A3 in the details table
5 B B1 Complete There are only Y values for the owner=B and name=B1 in the details table
5 B B2 Not Started There are only N values for the owner=B and name=B2 in the details table
I know I'll probably need countifs to work out if there are Y's and N's present, plus an IF to turn the output into the words, it's the getting to the point where I can count the Y's and N's present for each owner+name that I'm struggling with.
I have googled how I might find out if there were Y's and/or N's present for a given owner and name, and have come across this link which involves MATCH and INDEX but for the life of me, I can't get it working - I get an output of #N/A, using the following formula to get the first status:
=INDEX(A2:D12,0,MATCH(c2,'<Detail worksheet>'!A2:D12,0))
Am I on the right lines or is there a better way of doing this? (I could always manually specify the range of rows to look down in the details "table" for each summary "table" row, but I'd like to avoid that if possible!)

I split the formula into two parts, which should get you most of the way there. If you have an uncertain length of data, then be careful with how many rows you examine, my answer only goes to row 13.
Summary Sheet with columns added to split formula
Sheet 1
The formula for the Y column in the above picture is:
=COUNTIFS(Sheet1!$E$3:$E$13,Sheet2!$D$2,Sheet1!$B$3:$B$13,Sheet2!$B3,Sheet1!$C$3:$C$13,Sheet2!$C3)

Related

Sum values using lookup table, where lookup values are a list of values with comma delimiter

I am trying to sum values based that equal a lookup value. However, that value is actually a list of values delimited by a comma. Below is an example of what I mean.
Suppose I have raw data in the form of sheet1 below:
Sheet1:
A
B
1
ID
VALUE
2
A
30
3
A
50
4
A
20
5
B
10
6
B
20
7
C
70
8
C
40
9
D
30
10
E
50
11
F
20
12
F
30
13
G
10
And I have a look table that groups all IDs by their respective teams, as per sheet2 below.
Sheet2:
A
B
1
TEAM
IDS
2
Red
A, B
3
Blue
C, D
4
Green
E, F, G
And I want to create a report where the user can select the team name, and the sum of the values in sheet1 will aggregate based on the selection, as per the following example. So the user would select "Green" in cell B1 and it would return the sum of values that correspond to E, F, and G in sheet1.
Report:
A
B
1
Select Team:
Green
2
Sum:
110
I have searched all over for a solution to this and was able to find something similar. I tried to repurpose the formula for my data but couldn't get it to work because I think that solution dealt with numbers rather than text.
Excel: Perform a SUMIF where the criteria is a comma-delimited list
Any suggestions would be greatly appreciated!
Edit: Just want to add that I realize I could first parse out the IDs in sheet2, however I'm looking for a formula that can bypass that as my real dataset is quite large and parsing out the IDs under each team would explode the number of rows.
A variation of #JvdV solution on the linked question:
=SUMPRODUCT(SUMIFS(Sheet1!B:B,Sheet1!A:A,FILTERXML("<t><s>"&SUBSTITUTE(VLOOKUP(Sheet2!F1,Sheet2!A:B,2,FALSE),",","</s><s>")&"</s></t>","//s")))
Note, this only works with Excel 2013 or later and only on PC. FILTERXML is not available on Mac or prior to 2013.
If Mac or prior to 2013:
=SUMPRODUCT(SUMIFS(Sheet1!B:B,Sheet1!A:A,TRIM(MID(SUBSTITUTE(VLOOKUP(F1,Sheet2!A:B,2,FALSE),",",REPT(" ",999)),(ROW($ZY1:INDEX($ZY:$ZY,LEN(VLOOKUP(F1,Sheet2!A:B,2,FALSE))-LEN(SUBSTITUTE(VLOOKUP(F1,Sheet2!A:B,2,FALSE),",",""))+1))-1)*999+1,999))))

Ignore text values in subtotal function

Excel-Sheet:
A B C D E
1 1.200
2 Product A 500
3 Product B 400
4 Product C OK
5 Product D #NA
6 Product E 300
7
8
In the above table I have list of products in Column A and some data about the products in Column B.
In Cell B1 I want to calculated the subtotal of Column B using =SUBTOTAL(9,B2:B6).
However, now I have the issue that Column B not only consists of numbers.
It can also have the data type text (OK, NA). Therefore, the result in Cell B1 currently is #NA.
Is there any kind of formula that I could use so only the number data is considered and the result is 1.200 as in the table above?
Please note:
This function =AGGREGATE(9,6,B2:B6) won't help me because I want to filter the list later on so I need to go with the SUBTOTAL.
Use 7 as the second criterion in AGGREGATE instead of 6 as it will also exclude hidden rows:
=AGGREGATE(9,7,B2:B6)
You can solve this, combining the Excel worksheet functions =Value() and =IfERROR():
The function =Value() gives the value of a number, and in case of text it gives an error.
=IfError() can be used to give 0 in that case.
So, imagine you have following situation:
Column A Column B Column C
1 =Value(A1) =IfError(B1;0)
3.5 =Value(A2) =IfError(B2;0)
AB =Value(A3) =IfError(B3;0)
abc10 =Value(A4) =IfError(B4;0)
This gives following results:
Column A Column B Column C
1 1 1
3.5 3.5 3.5
AB #Value 0
abc10 #Value 0
You can simply take the sum of column C.
So this is based on the summary in B1.
=SUM(IF(ISERROR(B2:B6),"",B2:B6))
You need to push Ctrl+Shft+Enter for this to work.
Hope it helps.

Display the column number of the last non-empty cell within a range (if values are not unique)

I have the following Excel spreadsheet:
A B C D E F G H I J K L
1
2
3
4 600 150 80 600 0 0 4
5 200 150 80 80 0 0 4
6
7
In Range K4:K5 I currently use the formula from this question to identify the last non-empty cell within the range and get the the column number of it back:
K4 = LOOKUP(2,1/(D4:J4<>0),COLUMN(D4:J4)-MIN(COLUMN(D4:J4))+1)
K5 = LOOKUP(2,1/(D5:J5<>0),COLUMN(D5:J5)-MIN(COLUMN(D5:J5))+1)
This formula works in the simple example above. However, once I use this formula in a bigger spreadsheet I get a lot of performance issues and numbers are not always updated correctly.
Therefore, I am wondering if there is alternative formula to get the column number of the last non-empty cell no matter if the values are unique or not?
As already described in the comments below the question the following solutions are available:
Option A)
If you want to get column number of the last non-empty cell:
=AGGREGATE(14,7,(COLUMN(D4:J4)-MIN(COLUMN(D4:J4))+1)/(D4:J4>0),1)
Option B)
If you want go tet the value in the last non-empty cell:
=INDEX(D4:J4,AGGREGATE(14,7,(COLUMN(D4:J4)-MIN(COLUMN(D4:J4))+1)/(D4:J4>0),1)
=INDEX(A4:J4,AGGREGATE(14,7,COLUMN(D4:J4)/(D4:J4>0),1)

Excluding empty cells ("") from ascending list with Index function

I have the following Excel table:
A B C
1 Boris 4 *
2 Anna 6 *
3 Uli 5 *
4 Inge 4 *
5 Rudi 3 *
6 Ulla 7 *
7
8
9
:
:
99
*In cells C1 to C6 I am using the matrix formula:
={INDEX(A:A;VERGLEICH(KKLEINSTE(B$1:B$99-ZEILE($1:$99)/9^9;ZEILE(A1));B$1:B$99-ZEILE($1:$99)/9^9;0))}
to get the list sorted by names from the smallest to the the highest number according to column B.
The issue is now that my list has 99 rows (as you can see in the table) but not all of them are filled (as you can see in row 7 - 99 in the table).
Therefore, the formular in cell C1 to C6 shows now the value 0 because "" (empty cell) is the smallest value in the list from B1 to B99.
How do I have to change the formular that it considers all values in column B except for the cells that are empty? (Note: If a cell in column B has the value 0 it should be considered. Only when the cell is empty it should be excluded)
Thanks for any help :-)
Just add a condition to check for numericalness:
=INDEX(A:A,MATCH(SMALL(IF(ISNUMBER(B$1:B$99),B$1:B$99-ROW($1:$99)/9^9),ROWS($1:1)),B$1:B$99-ROW($1:$99)/9^9,0))
In German:
=INDEX(A:A;VERGLEICH(KKLEINSTE(WENN(ISTZAHL(B$1:B$99);B$1:B$99-ZEILE($1:$99)/9^9);ZEILEN($1:1));B$1:B$99-ZEILE($1:$99)/9^9;0))
I have replaced ROW (ZEILE) with ROWS (ZEILEN) as it is a more rigorous choice for SMALL's k parameter:
http://excelxor.com/2014/08/25/row-vs-rows-for-consecutive-integer-generation/
Regards

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Resources