Find all increments of +1's starting from a given number in a column in excel - excel

I have 2 columns x and y
x Y
0 1
1.645 7.897
3.444 6.4387
2.345 5.9090
3.890 5.4322
4.789 3.4321
5.666 4.1111
keeping x at a constant value ( say i pick 3.890) i want to find all increments of +1's of the corresponding Y column . In the above example I want (5.4322 + 1 + 1 + 1 ) upto a certain range.In the above example i want the values (6.4387, 7.987) .If an exact +1 value does not exist i want the closest value to it .Is there a formula i can use to achieve this in excel ? . Any help is much appreciated.
expected output :
New column
5.4322
6.4387
7.897

Suppose you have the following named ranges:
x being values under x column;
y being values under y column;
Pick_x being the selected value from x column.
Enter the following formula in Cell G2 and drag it down to G8:
=IF(INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1)>MAX(y),"",INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1))
It will return the corresponding y value +1s based on the selected x value, but will show blank if the +1 value is outside the range set by y column.
Then enter the following array formula (confirm by pressing Ctrl+Shift+Enter in the formula bar) in Cell H2 and drag it down to H8:
{=IFERROR(INDEX(y,MATCH(MIN(ABS(y-G2)),ABS(y-G2),0)),"")}
It will return the corresponding closes match from y column based on the value in Column G, and return blank if there is no value in Column G.
I used Column G as a helper column but you can choose to replace G2 in the second formula with the first formula, but it will make the formula too long to be easily understood.
If I change the x value to 4.789, Column H will return the following:
Let me know if I've misinterpreted your question. Cheers :)

Related

Return Multiple Unique Matches in Excel without Array Formula

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

Index Minif excel

I need a formula that looks for a value in column A, finds the smallest value of that row and displays the corresponding value of a row on the top of the sheet (row 3 in my case) where the smallest value has been found.
also would like to find the second and third smallest value and display the value of row 3.
For example: I need to lookup X in the first column, find the smallest value in that row (1) and display the value on the row on top of that column (D)
and second smallest value for X to display C, third smallest for X to display E.
enter code here
A B C D E F
Z 6 8 9 5 2
X 7 2 1 3 7
Y 9 2 6 1 6
This codes should work:
=INDEX($B$2:$F$2,MATCH(MIN(IF($B$1=$A$3:$A$5,$B$3:$F$5)),INDEX($B$3:$F$5,MATCH($B$1,$A$3:$A$5,0),),0))
!https://imgur.com/2YFu39E
Suppose your data are in range A1:F4 as shown below:
You can use the following formula to find the 1st, 2nd and 3rd smallest value in the row starting "X". Put it in Cell I2 and drag it down.
=SMALL(INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0),),H2)
Then you can use the following formula to find the corresponding value in the row starting "Z":
=INDEX(INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0)-1,),,MATCH(I2,INDEX($B$2:$F$4,MATCH("X",$A$2:$A$4,0),),0))
It is basic INDEX+MATCH approach. If you have problem understanding the solution, I suggest you to google some online tutorials on the use of INDEX+MATCH. SMALL function is used to find the nth smallest value as requested.
Cheers :)

Replace AND with NOT function in formula

My Table looks like :
Table.xlsx
* The table needs to be downloaded to get formula works on.
On column "W" I have the following formula :
=IF(AND(J19="HLD";Q19="");"HLD";"")
Which will add value "HLD" in column W if HLD value exist in column J and Column Q is empty.
My problem with this formula is that I have more then one value ( CNA , CFF , HLD ) which needs to be considered as HLD in column W .
When I try to :
=IF(AND(J19="HLD , CNA , CFF";Q19="");"HLD";"")
The formula doesn't work .
Interesting here is that I need all values except STD to be valued as HLD in column W and I was thinking for something like :
=IF(NOT(J19="STD";Q19="");"HLD";"")
But looks like doesn't work.
Other problem which I'm facing in this table is that.
In column X I have the following formula :
=IF(C19="";"";IF(AND(K19="Putaway";MID(J19;1;3)="CFF");0;NUMBERVALUE(C19)))
Which will do the following :
If in column K we have value Putaway and if column J have value CFF will be counted as 0
For the rest of values in K and J columns the formula will copy the value from column C .
My problem with here is that I have more then one value in column J which needs to be counted as 0 . I want all values CNA , CFF , HLD to be counted as 0 or other way around ... all except HLD to be counted as 0 .
Thanks for support
Formula in Cell W2 and drag it down.
=IF(AND(J2<>"STD";Q2="");J2;"")
<> will work as the "NOT" you were after. NOT function in excel is not working in the way you want. The above formula will return the value from Column J as long as the value in column J is not STP AND column Q is blank "".
Formula in Cell X2 and drag it down.
=IF(C2="";"";IF(AND(K2="Putaway";J2<>"STD");0;NUMBERVALUE(C2)))
If you understand the use of `<>' in the last formula, then there is no need to explain further for this one.
Let me know if you have any questions. Cheers :)

EXCEL counting empty rows

A B C D E F G H
1 Y Y Y X
2 X X
3 Y Y
4 X X
5 Y Y Y X
Count the number of empty rows (from Columns A to E) and put result here. Answer should be 2 from example above.
Hi Folks,
I'm struggling to find the correct Excel formula to count the number of rows with no data from columns A through E, and putting that answer in a cell. These 'empty rows' may have data in later columns (like F, G, H), but I just want to count the rows with no data from columns A to E.
Any help would be appreciated.
Since array formulas tend to confuse people, here's a non-Array formula approach:
Place =IF(COUNTA(A1:E1)=0,1,0) into row 1 of (for example) column I and drag down to row 5. Then place a sum formula below that to get the answer, for example: =SUM(I1:I5)
Try this array formula,
=SUM(IF(ROW(1:5), IF(A1:A5&B1:B5&C1:C5&D1:D5&E1:E5="", 1)))
Remember to finalize with ctrl+shift+enter, not just enter.
You could also use a variation on the standard formula for getting row sums of a 2d array
=SUM(N(MMULT(N(A1:E5=""),TRANSPOSE(COLUMN(A1:E5)^0))=COLUMNS(A1:E5)))
or
=SUM(N(MMULT(N(A1:E5="Y"),TRANSPOSE(COLUMN(A1:E5)^0))=0))
Again they are array formulas and have to be entered with CtrlShiftEnter

Compare in two columns and add value

I have 2 columns looking like this:
Column 1 Column 2
1 x
x 2
2 2
x x
1 2
I want to do two things;
For each row match (row n column 1 = row n column 2) it should mark cell n in column 1 green if there is a match and red if it is not.
It should create a sum cell where each match is worth 1 point, in this case column 1 should result in 2 points.
Is this even possible with excel and if so, how is it done?
For the first part of your question:
It should mark cell n in column 1 green if there is a match and red if it is not
You can do this using Conditional Formatting.
Ex:
Assume column A and column B, with the values starting in row 2.
The following conditional formatting would highlight column A values in green if they match the corresponding value in column B in the same row, otherwise red.
Highlight the values in column A, then apply this conditional formatting.
For the second part of your question
It should create a sum cell where each match is worth 1 point, in this case column 1 should result in 2 points
The following array formula will tally all the matches and show you how many there are:
=SUM(IF(A2:A6=B2:B6,1,0))
Assuming again that we are in columns A & B with your sample data.
Remember to commit this formula using Ctrl+Shift+Enter.
Per comment from andy holaday, here is another formula that will work:
=SUMPRODUCT(N(A2:A6=B2:B6))
or
=SUMPRODUCT(--(A2:A6=B2:B6))
These are not CSE formulas so you would not need Ctrl+Shift+Enter to commit them.

Resources