Finding Value In Excel Based On Highest Value and Matching Value in Excel - excel

I have three rows in an Excel sheet that I need to get values from. Row 1 are just set numbers, Row 2 is values, and Row 3 is another value with many having the same value. I need to first check for the highest value in Row 3, match it with the value in Row 2, get the highest value in Row 2 first if Row 3 is the same, and then report Row 1 as the answer.
1 2 3 4 5 6 7 8 9 10 11 12
15 16 17 18 19 20 21 22 23 24 25 26
4 4 2 1 5 7 4 3 1 5 3 3
So I want to have it output as:
6 10 5 7 2 1 12 11 8 3 9 4
I tried a few HLOOKUP values but nothing seems to be hooking. Any ideas?

For a formula answer use this array formula:
=INDEX($A$1:$L$1,MATCH(LARGE(($A$3:$L$3*10000)+$A$2:$L$2,COLUMN(A:A)),($A$3:$L$3*10000)+$A$2:$L$2,0))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting Edit mode. If done correctly then Excel will put {} around the formula.
So enter the formula in the first cell, hit Ctrl-Shift-Enter Then drag/Copy across the number of columns desired.

Related

I want range for specific value in excel

I want range for specific value in excel as,
my values
1
2
3
4
5
6
7
8
9
10
and suppose compare value is 2.5. If 2.5 is value then it should return range 2 and 3 in separate row for further calculations. Similarly i input value is 5.2 then it should return range 5 and 6 in separate row for further calculations
Cell E6 is the place where you have enter the value
=IFERROR((--LEFT(E6,1))&"-"&(--LEFT(E6,1)+1),"0-0")
if entered value is 5.5 the output will be 5-6

Excel Hlookup function returning the first character in table

I am using Hlookup to find in a row where the value is "A", and then subsequently take a binary value in the same column and use this as the selected cells value.
I am only using the formula bar for this part. The cells formula is:
"=HLOOKUP("A",A13:Z19,1)"
Row 13: SNPHUATVBKWJZYMQGXFCROEILD (Each character is assigned to an individual cell).
In row 19, each cell is taken up by 5 binary digits, so to keep things tidy I will write the decimal numbers:
10 3 2 20 18 6 24 2 12 21 30 4 6 26 19 22 9 13 5 24 0 31 12 15 24 9
The issue is that, while my formula should return 6, as that is the corresponding value within the same column as the letter "A", it returns 9, which is the first cell on the top right of the search criteria table.
Also worth noting is that if I post in a different cell a similar formula but perhaps change the search criteria to a different character such as "H", then the same error will occur, returning a 9.
Thank you so much in advance!

Excel formula using countif

There are 11 numbers in a column.
5
5
5
5
12
13
5
9
2
5
10
I need to build a formula that tells me how many times occurs the following situation: Number is bigger than each of previous four numbers.
In this case the situation occurs 3 times. By:
12 bigger than 5;5;5;5
13 bigger than 12;5;5;5
10 bigger than 5;2;9;5
Assuming your data starts in A1 you can use if() and max() to do this. Add this to B5 (next to the 12 in your example):
=IF(MAX(A1:A4)<A5, 1, "")
This will put a 1 next to 12. You can copy this formula down to find the other values where this is true.
This works by looking at the MAX() value of the previous 4 values. IF() they are higher than the current value, then it prints a 1.

Sorting row by row

I have a table in excel which has values like below
2 1 3
6 5 4
7 2 3
Considering the rows do not have a column header, what is the easiest way to sort them row by row, such that I get the below output
1 2 3
4 5 6
2 3 7
If the array starts in A1 please try (UNTESTED) in AB1 copied across 27 columns and down to suit:
=SMALL($A1:$AA1,COLUMN()-27)

Sum only visibile cells using SUBTOTAL in Excel

I'm intending to get the current balance of a stock using an Excel sheet. In this workbook, the balance is entered every day. However only the most recent day's balance is actually shown, all other are hidden. The data is entered in columns, and hence only one column of data is shown.
In this example, I want to sum the values from row 21 to 24. I enter the formula from the first documented balance, to some columns ahead in time (so the range does not need to be changed often).
For this I use:
=SUBTOTAL(109,C21:O24)
The last column's values sums to 20. However, using this formula sums to 260. It actually sums all values in row 21 to 24!
I confered the site https://support.office.com/en-us/article/SUBTOTAL-function-7b027003-f060-4ade-9040-e478765b9939 where it says that the value "109" should be used as the first argument in order to only sum non-hidden values. But evidently, this does not work. I also tried to use "9" as the first argument as well with the same result.
What is it that I am missing? Why doesn't this formula execute as intended?
MCVE (I reckon that if this is copied into cell A20, the value should become 260. When hiding all columns but A,B and O should give 20 using SUBTOTAL, but for me it still produces 260).
Stock
Prod1 5 5 5 5 5 5 5 5 5 5 5 5 5
Prod2 5 5 5 5 5 5 5 5 5 5 5 5 5
Prod3 5 5 5 5 5 5 5 5 5 5 5 5 5
Prod4 5 5 5 5 5 5 5 5 5 5 5 5 5 =SUBTOTAL(109;C21:O24)
Regards
From the documentation:
For the function_num constants from 1 to 11, the SUBTOTAL function includes the values of rows hidden by the Hide Rows command under the Hide & Unhide submenu of the Format command in the Cells group on the Home tab in the Excel desktop application. Use these constants when you want to subtotal hidden and nonhidden numbers in a list. For the function_Num constants from 101 to 111, the SUBTOTAL function ignores values of rows hidden by the Hide Rows command. Use these constants when you want to subtotal only nonhidden numbers in a list.
So that can't be used to sum cells hidden by columns.

Resources