How to create a one to many relationship? - excel

The title may be confusing/misleading; I'm frankly having trouble trying to say what I need in a concise manner.
I have 2 lists of distinct values in Excel.
List A:
1
2
3
List B:
C
D
E
I need to create a sheet that shows a one to many relationship where List A is the 'One' and list B is the 'Many'. So the result would be something like :
Ouput:
1 C
1 D
1 E
2 C
2 D
2 E
3 C
3 D
3 E
The results are not concatenated and are in their own cols/rows. Any suggestions?

Assuming list 1 is in A1:A3, list to is in B1:B3. Then in D1 put :
=IF(CEILING(ROW()/ROWS($A$1:$A$3),1)>ROWS($A$1:$A$3),"",INDIRECT("A"&CEILING(ROW()/ROWS($A$1:$A$3),1),TRUE))
and in E1 :
=IF(CEILING(ROW()/ROWS($B$1:$B$3),1)>ROWS($B$1:$B$3),"",INDIRECT("B"&IF(MOD(ROW(),ROWS($B$1:$B$3))=0,ROWS($B$1:$B$3),MOD(ROW(),ROWS($B$1:$B$3))),TRUE))
and drag both downwards.
Idea : Use row() to 'guide' how the which cell will indirect() address to. You can test the given mod() and ceiling function separately to 'examine' how the pattern works. [do ask if you didn't get it.] (:
please share if it works/not.

Related

List result of lookup A in B, B in C without helper column

I have 2 tables:
Table1 containing Customer & Part#
Table2 containing Part# & Type
(The actual data lists are larger)
Table1 (Customer & Part#) & Table3 (Helper):
Customer
Part#
Helper
A
1
X
B
2
Y
C
3
X
A
4
Y
A
5
X
A
5
X
A
2
Y
Table2:
Part#
Type
1
X
2
Y
3
X
4
Y
5
X
Desired result for combination of customer A and Type X:
Part#
1
5
5
These being the 3 results of part numbers in Table1 that are Customer A and the lookup of the Part# results in Type X (see also Helper column).
I'm able to retrieve the results by creating the helper column as shown in the example data, however I want to skip this column and solve it in one go. But I don't know if that's even possible.
I was thinking about something in this direction.. =INDEX (Table1[Part'#],IF(Table1[Customer]="A",ROW(Table1[Customer]))
..but there I get stuck. I think I can pickup from there with IF, ISNUMBER, SEARCH but my head errors there.
Does anybody know a way to skip the helper column for this?
PS I have office365, but FILTER is not yet released by company rules (unfortunately).
PS I prefer a formula solution, but VBA is allowed when necessary
Here is a formula solution for Excel version 2010 to 2019
In I3, formula copied down :
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(A$3:A$9)/(VLOOKUP(N(IF({1},B$3:B$9)),D$3:E$7,2,0)=H$3)/(A$3:A$10=G$3),ROW(A1))),"")

EXCEL Sum up points based on placements (combine VLOOKUP and SUM)

e.g. I have a list of race results:
A B C D E F...
NAME P. RACE1 RACE2 RACE
abc =? 1 3 3
bcd 3 2 4
cde 4 4 2
def 2 1 1
and another sheet with points for each result:
A B
PLACE POINT
1 10
2 5
3 2
4 1
Is it possible to get the total points in sheet1 column B based on the race results in column C-E..?
Is it a connection from VLOOKUP and SUM?
Yes, that's possible. You can use a SUMPRODUCT formula for that. You may use this one in column B:
=SUMPRODUCT((C2:E2=$A$13:$A$16)*$B$13:$B$16)
Your result will look like this:
This is an array function. The term C2:E2=$A$13:$A$16 will check for race 1 to 3 if it was 1st, 2nd, 3rd or 4th place. This will result in an "imaginary" array of TRUE and FALSE. For name "abc", it will look like that.
Those results are then multiplied with the points from B13:B16 and the sum is formed.
In Excel O365, one could use:
Formula in B2:
=SUM(VLOOKUP(C2:E2,H$2:I$5,2))

Excel: sort names by given values

I had to do a little work with excel but I am stuck at the following point:
A B C D E F ....
1
2
3 "A" 1
4 "B" 0
5 "C" 1
6 "D" 2
7
8
9
My table looks something like this.
In B3:B6 I do have 4 names, in C3:C6, I do have the corresponding scores.
Now, I would like to order the names by their given points and display them in E3:E6
I am not that familiar with excel so I am very happy for any help.
Greetings,
Finn
First get the numbers in order with Large Function:
=LARGE($C$3:$C$6,ROW(A1))
Put that in F3 and copy down 4. It will list the numbers in order.
Then in E3 put this formula:
=INDEX(B:B,AGGREGATE(15,6,ROW($C$3:$C$6)/($C$3:$C$6=F3),COUNTIF($F$3:F3,F3)))
Which looks up the corresponding name.

Making multiple copies of a cell and duplicating it for a list

I have a list of different names that I would like to duplicate each one by 3 copies of itself. For instance:
A
B
C
D
E
to the following:
A
A
A
B
B
B
C
C
C
D
D
D
E
E
E
How I would I accomplish this in excel? Can it be done in Excel?
There are SOOO many ways to do this... One way would be using something along the lines of the OFFSET() function like so:
Supposing your original list was in cells A1:A5, say. You could then put this formula where you want it:
=OFFSET($A$1,ROUNDDOWN((ROW(A1)-1)/5,0),0)
and drag it down for the 25 rows you want.
In essence, what you're saying is:
Offset cell A1 by ROUNDDOWN((ROW(A1)-1)/5,0) rows and 0 columns.
Looking at that ROUNDDOWN() function:
Row(A1) = 1 (Similarly, Row(A2) = 2, etc...
(Row(A1)-1) / 5 = 0/5 ; 1/5 ; 2/5 ; .....
Rounddowwn(...) means 0/5 to 4/5 becomes 0 ; 5/5 to 9/5 becomes 1 ; etc
Therefore, it will offset A1 by 0 rows and 0 columns 5 times then by 1 row and 0 columns for the next 5, etc.
Hope that makes sense :)
EDIT:
The original question asked for 3 copies of each value, not 5 - I'm leaving the answer as-is purposefully with this edit so someone else can see how to change it to any number of repetitions as wanted... All that would change would be:
=OFFSET($A$1,ROUNDDOWN((ROW(A1)-1)/3,0),0)
Simply, divide by 3 rather than 5 for that to occur...

agregate in vertical 2 or more colums in EXCEL

I'm looking for a way to take these columns (Name/value)..
Name Value Name Value
a 1 c 3
b 2 d 4
and join them together as follows:
Name Value
a 1
b 2
c 3
d 4
Thanks
A PivotTable constructed with multiple consolidation ranges (one for each pair) would achieve the result you want (but might be little easier that copy and paste):

Resources