Formula to determine latest ordered entry of unique table values - excel-formula

I'm looking for some help in creating a column populated with 1's for the (in this example) 'latest' revision of each unique entry (in another column).
Project # Rev Flag
=========================
FCA1 A
FCA1 D 1
FCA1 B
FCA1 B
FCA1 C
FCA1 C
BRS1 A
BRS1 B 1
BRS2 A 1
FCA2 A
FCA2 A
FCA2 B
FCA2 B
FCA2 C 1
FCA2 C 1
BRS3 A 1
FCA1 D 1
FCA1 D 1
FCA1 A
My desired output is in the 'Flag' column in the above example. For example, all Rev D's for project number FCA1 and all Rev C's for FCA2. Same thing for the other values under Project #. Note that I'd like this done independent of the order or sorting of the entries. The example just happens to show them in some sort of order for clarity.
I'm working with Excel 2010.
Thank you!

The formula you want is:
=IF(MAX(INDEX(($A$2:$A$20=$A2)*CODE($B$2:$B$20),0))=CODE($B2),1,"")
E.g.:
EDIT
Re the question how can I error handle when there is a blank entry in the Rev column? It's not possible if you are using A, B, C and D as revision codes because the CODE function won't handle an empty string in the formula I presented. If you switch to number-based revisions then it will work with this formula:
=IF(MAX(INDEX(($A$2:$A$20=$A2)*$B$2:$B$20,0))=$B2,1,"")
Noting that this is the same formula as above but without the CODE function usage. E.g. if A=1, B=2, C=3 and D=4 then:

Related

Need help inputting data in excel columns from other columns

If I had data in rows A to E as seen below in the table. Some of the values can be NA. IN column F if i wanted to input data from columns A to E in a way that if data in A exists use that otherwise if data in B exists use that otherwise until column E. If none of them have any values return NA. I would like to automate this where somewhere I just specify the order for example A, B, C, D and E OR A, C, E, D, B and the values in F update according to the reference table
Reference : C - B - A - E - D
a
b
c
d
e
f
3
4
3
2
2
7
1
7
NA
1
4
2
4
2
2
4
2
2
Use FILTER() with # operator.
=#FILTER(A2:E2,A2:E2<>"","NA")
For dynamic array approach (spill results automatically), try-
=BYROW(A2:E7,LAMBDA(x,INDEX(FILTER(x,x<>"","NA"),1,1)))

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))),"")

Sort Data in Excel in a Sequence

Is it possible in Excel file to sort the data in a sequence?
I am trying to sort my data with the following details for example:
Column A
A
A
B
B
The output should be like this:
Column A
A
B
A
B
what you may perhaps try, is to have a column B added and put number behind from 1 to 2 so A and 1 A and 2, then B and 1 and B and 2 and sort afterwards by column B ... Don’t know, if this is solving your problem ... 🤔

How to create a one to many relationship?

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.

Hierarchical auto-numbering (with three levels) in Excel

What if we have a three-level hierarchy and need to enumerate only "B"s (according to the pattern), but some "C-"s interfere with "B"s.
Problem: to get column B result from a given column A.
A+
B 1
B 2
С-
B 3
A+
B 1
С-
B 2
A+
С-
B 1
B 2
B 3
P.S. The task arose from the need to enumerate complex hierarchy in Excel.
Imagine that A - level 1; B - level 2; C - level 3. (with some abuse of logic in the example above as C- in the pattern goes after A, which in practice is usually not the case).
The simple case of two-level hierarchy is shown here.
Easiest would be to add in two intermediary helper columns, the first of which we'll call column C. Here, we will count only which "A+" we're on, like so [starting at C2; C1 is hardcoded as 1]:
=IF(A2="A+",A1+1,A1)
This will increment every time a new row has "A+" in column A.
Then column D will track the highest # reached so far, for that iteration in column C [starting at D2; D1 is hardcoded at 1]:
=IF(A2="A+",0,if(A2="B",B2,D1))
This will restart at 0 for each new "A+", and for each "B" it will take the value shown in column B. Then for each "C", it will simply repeat the value from the row above (the previous "B" reached).
Finally you can put in your sort, as follows [starting at E1]:
=IF(A1="B",B1,"")
This will show BLANK for either "A+" or "C", and will show the B-count if column A = "B".
I also went with a helper column (as much as I detest them personally) to show the row of each A+
Put this in C1: =ROW(A1)
Put this in C2: =IF(A2="A+",ROW(A2),C1)
It uses an expanding range with a rebasable starting point. Drag down as far as your data goes.
Put this in B2: =IF(OR(A2="C-",A2="A+"),"",IF(A1="A+",1,MAX(INDIRECT("B" & C2 & ":B" & ROW(A1)))+1))
Drag down as far as your data goes.
Hope that helps. Here are the results I received:
A+ 1
B 1 1
B 2 1
C- 1
B 3 1
A+ 6
B 1 6
C- 6
B 2 6
A+ 10
C- 10
B 1 10
B 2 10
B 3 10

Resources