I am trying to access a value in a separate column in excel which corresponds to the first empty cell in my table.
An example is
A B C D
E F G H
I J K
L M N O
i want to show "I" since it corresponds to the first null value in the 4th column.
No CSE required:
=IFERROR(INDEX(A1:A4,1/MAX(INDEX((LEN(A1:D4)=0)/ROW(A1:D4),))),"No null values")
Something like:
{=IFERROR(INDEX($A$1:$D$4, MIN(IF($A$1:$D$4="", ROW($A$1:$D$4)), 9E+99), 1), NA())}
You must use Ctrl-Shift-Enter to enter this formula
Related
I have a very large table with repeating values based off of a ID column. I'm after a function/combination of excel functions that would work to return the ID number where all instances of a searched value are met?
I dont have access to the "Filter" function so im looking for an alternative to this.
E.g, I wish to find all instances of F in the table. From here the function should return the row/associated "ID"
This would then output 2,4,25 where the matches in the table occur
ID
B
C
D
...
BB
BC
SEARCH
F
1
A
B
C
D
E
G
2
D
E
G
F
G
S
3
T
V
A
K
H
E
4
Y
F
J
N
R
K
5
I
O
W
H
X
Z
...
25
T
K
Q
E
H
F
array formulaļ¼
=IFERROR(INDEX(A:A,SMALL(IF(B$1:G$500="F",ROW($1:$500)),ROW(A1))),"")
You can try creating an extra column at the end and use this formula in each cell down that column. Make sure your "Search Cell" remains same in the formula though:
Drag this down from first cell down to all rows but make sure the search cell remains same. i.e. B1 in my example. I have added a last extra column H in my example to do this calculaton and the result:
=IF(IFERROR(MATCH(B1,B2:G2,0),"")<>"",A2,"")
Given an Excel table of shape
Col. A Col B Col. C Col. D Col. E
x 2 x 2 3
x 3 y 7
y 7 z -5
x 2
z -5
I want to return the first unique hit in Column B for argument "x" in Column D,
the second unique hit in Column B for argument "x" in Column E and so forth.
The formula I'm currently using in cell D1 for this is
{=IFERROR(INDEX($B$1:$B$5,MATCH(0,COUNTIF($C1:C1,$B$1:$B$5)+($A$1:$A$5<>$C1),0)),"")}
which is working.
The problem I'm having is that since this is an array formula and since I'm analyzing a decent amount of data computation time for my sheet is too high.
Is there an alternative for this functionality avoiding an array formula?
Thanks!
Haven't got time to test this properly, but if you have Excel 365 you can use a single formula per row and it may be faster:
=TRANSPOSE(UNIQUE(FILTER(B1:B10,A1:A10=C1)))
in D1.
EDIT
To pull the formula down, you need static references as OP has pointed out. Probably should check for empty cells in column C as well, so formula becomes:
=IF(C1="","",TRANSPOSE(UNIQUE(FILTER(B$1:B$10,A$1:A$10=C1))))
I have column A as city code, B as Origin City,St , C as city code, D as Destination city,St. I then similar date in I through L with Carriers that haul those lanes in N. If a row in the I through L match a row in A through D I need the value of F place in the O column in the corresponding row.
I am trying to paste an image of the Excel grid, but I need column O to pull the value from column F from the row that has the values from A to D that match the data in a row in I to L.
Expected Result in Grid
You can use a combination of index() with match()
So, to fill Column O, this should work:
=INDEX(F$40:F$60,MATCH(I40&K40,G$40:G$60,0))
I have assumed that you can add a helper column in G, which is =A40&C40 dragged down.
I have also assumed that the combination of the two numbers in cols A & C are unique when combined.
If that is not the case then you will need to add col B, so the helper column becomes =A4&B40&C40 and the match will be I40&J40&K40.
Tested this on 3 values, as you don't give data I can get to.
I am trying to find an average of 1 column if the number in the column is greater than 0 and another column is either a C or a P. I was trying to use the Averageifs formula but its is not giving the correct information.
Here is a sample of the table with some dummy data:
Column G Column H
Type (L,S,C,P) Proft/Loss
C $153.00
L $(25.00)
P $(10.00)
S $15.00
C $20.00
L $100.00
P $(50.00)
S $(150.00)
C $(50.00)
P $(52.00)
L $75.00
S $(75.00)
C $50.00
P $75.00
L $150.00
S $(10.00)
These are the formulas I have tried:
=AVERAGE(AVERAGEIFS($H$29:$H$1000,$G$29:$G$1000,({"C","P"}),$H$29:$H$1000,">0"))
=AVERAGEIFS($H$29:$H$1000,$G$29:$G$1000,({"C","P"}),$H$29:$H$1000,">0")
=AVERAGE(IF(ISNUMBER(MATCH($G$29:$G$1000, {"C","P"},">0")), $H$29:$H$1000))
Any assistance would be greatly appreciated.
the problem is that the first will return two numbers; one for the C and one for the P and then average the two, which gives too much weight to p in your data set.
The second will only do the first array value
The third will need some work to the MATCH for two criteria and is entered as an array formula with Ctrl-Shift-Enter.
I propose:
=SUM(SUMIFS(H:H,G:G,({"C","P"}),H:H,">0"))/SUM(COUNTIFS(G:G,({"C","P"}),H:H,">0"))
Here's another solution:
=AVERAGE(IF(A2:A17="C",IF(B2:B17>0,B2:B17,"NO"),IF(A2:A17="P",IF(B2:B17>0,B2:B17,"NO"),"NO")))
Hope that helps.
Into column D, I'd like to copy the value from the last cell with data in columns E up until the column with the header "DETAIL". There might be anywhere from 2 to 15 columns from E until the column with that header, so that's where I'm stuck. So to be clear, an example:
A B C D E F G H DETAIL
1 x x x a b c d x
2 x x x x
3 x x x c b a x
3 x x x d c x
Should fill column D like so:
A B C D E F G H DETAIL
1 x x x d a b c d x
2 x x x x
3 x x x a c b a x
3 x x x c d c x
I don't mind handling this with a formula (which I couldn't come up with) or programmatically.
Create a dynamic named range by pressing CtrlF3 to bring up the Name Manager, click New, name the range something (I chose MyRange) and then use this formula to define it (Note you may need to change the Sheet name):
=Sheet1!E2:INDEX(Sheet1!2:2,MATCH("Detail",Sheet1!$1:$1,0)-1)
Then, in cell D2 and copied down, use this formula (I did not use IFERROR so that it would be backwards compatible):
=IF(COUNTA(MyRange),INDEX(MyRange,MATCH(REPT("z",255),MyRange)),"")
Here are the results (highlighted) using your provided sample data:
Please try:
=IFERROR(INDEX(F2:T2,,MATCH("zzzzzz",F2:T2)),"")
in D2 and copied down to suit.
Try using LOOKUP:
=IFERROR(LOOKUP(9^99,SEARCH("*",E1:H1),E1:H1),"")
SEARCH("*",E1:H1) returns a number when it matches any character and an error when the cell is blank. LOOKUP then returns the contents of the cells of the last number smaller than 9^99 in the array generated by SEARCH.
For example, in the first row, SEARCH("*",E1:H1) returns {1,1,1,1} so that LOOKUP returns the last 1, being d.
In the third row, SEARCH("*",E3:H3) returns {1, 1, 1, #VALUE!} and LOOKUP returns the last 1, which is a here.
This formula will work with numbers and text alike. The downside is that it is considered slower than INDEX/MATCH. On the other hand, you can modify the INDEX/MATCH to work with numbers, or modify it to work for both but becomes an array formula:
=IFERROR(INDEX(E1:H1,,MATCH(1,SEARCH("*",E1:H1))),"")
[Works with Ctrl+Shift+Enter, otherwise returns an empty cell with Enter alone]