Using CELL with ROW, INDEX, and MATCH Functions - excel

I'm working on trying to display the contents of a cell if data in the same row meets a certain criteria. In the case I am currently working on, if a value in a column is a maximum value I want to display the contents of that cell that is in the same row but different column.
My existing code is shown below:
=CELL("contents","B" & ROW(INDEX(E3:E75,MATCH(MAX(E3:E75),E3:E75,0)))
I know the "B" & ROW(INDEX(E3:E75,MATCH(MAX(E3:E75),E3:E75,0))) works as I have tried it in a different cell and it gives me the output I expected which was a string "B#". My issue is I can't seem to do anything useful with it, as its not acting as a cell input in formulas. I'm not quite sure what my issue is, but I would assume it has to do with syntax of how I'm inputting the data into the formula.

Just use the correct range in the INDEX and skip all the other work:
=INDEX(B3:B75,MATCH(MAX(E3:E75),E3:E75,0))

Related

Get cell range through getting cell addresses with formulas

I'm trying to write a formula that will allow me to count a number of lines used between a cell range. I created a test formula to see if my thought process was straight. For my test I put a header called "NUM" (A1) and then on the same column a bunch of rows of "1"'s then another header beneath the first array called "NUM2" (column A but could be anywhere) with more "1"'s under that as well. I'm using a formula to find the cell address to find the first header which is
=CELL("address",INDEX(A:A,MATCH("NUM",A:A,0),1))
which printed ($A$1) and then combining it with
=CELL("address",INDEX(A:A,MATCH("NUM2",A:A,0),1))
which printed ($A$14) to get the second header name, after that I'm using a COUNTIF function to count the ones like so:
=COUNTIF((CELL("address",INDEX(A:A,MATCH("NUM",A:A,0),1)))&":"& CELL("address",INDEX(A:A,MATCH("NUM2",A:A,0),1))),"1"))
and I thought that if I didn't use the formulas inside the formulas it would look like:
=COUNTIF($A$1:$A$14,"1")
which prints my desired number of 12. My question is can I not put the combination of the two formulas inside of the bigger COUNTIF statement?
You are just missing an INDIRECT which will turn your string into a cell reference.
=COUNTIF(INDIRECT(CELL("address",INDEX(A:A,MATCH("NUM",A:A,0),1)) & ":" & CELL("address",INDEX(A:A,MATCH("NUM2",A:A,0),1))),1)
A simpler version (assuming column A) would be
=COUNTIF(INDIRECT("A"&MATCH("NUM",A:A,0)&":A"&MATCH("NUM2",A:A,0)),1)
You could also use OFFSET.

Vlookup function doesn't return value

I used this VLookup formula to retrieve value from another sheet Sheet2 which contains a table with two columns NumEchelon, Indice:
=RECHERCHEV("1/1";Sheet2[NumEchelon];Sheet2[Indice];faux)
But it doesn't return any value, when i click on the cell i found just the formula not the value i want to retrieve from the sheet Sheet2.
Looks like you are using french version of Excel, so I will leave it up to you to find the translated commands. The basic problem from what I am gathering is you are looking up "1/1" in the named range NumEchelon. I am going to guess that this named range is 1 column wide. sheet2[Indice] is a separate chunk of data.
Vloopkup is supposed to search for a specified term in a table (usually 2 or more columns wide located to the right of the search column) and return a value in the same row as the found value in a specified column. The columns are numbered left to right with the first column being zero. The false or FAUX at the end tells it you want an exact match.
So without seeing your data I would say make sure that NumEchelon covers both columns of information, and INDICE column is to the right of NumEchelon. Where you have Sheet2 Indice replace with with a numeric value for the column its from the table you made for the vlookup.
So Assuming NumEchelon is A1:A8 and Indice is B1:B8 I would do the following:
Use a new named range "MonTableaux" and define it as sheet2!A1:B8
=VLOOKUP("1/1",MonTableaux,2,0)
Without the named range it would look like
=VLOOKUP("1/1",sheet2!$A$1:$B$8,2,0)
'note the 0 is the same as false
Now you may be using TABLES and I am not all that familiar with table so there may be short cuts. If that is the case someone point it out to me and I will delete my answer.
If your information you want to return in not lined up vertically with the information you are searching for or if the information you want to return is located to the left of what you are searching for you will want to use a combination of INDEX and MATCH. maybe something like this:
=INDEX(sheet2[Indice],match("1/1",sheet2[NumEchelon],0))
If the formula is showing up in the cell, and not a result like #N/A then the cell is likely formatted as Text, change it to General and click in the formula bar and hit enter again to show the formula result instead of the formula text.

Excel: How to sum values associated with certain strings in different columns

Excel Example Image
Hi there! My problem is a little hard to describe so I hope the title isn't misleading.
As you can see in the image, there is a column of different 2-letter-strings with associated values in another column next to them. On the right there is another table with all the strings and a column next to it where I want Excel to sum all the values that are associated with that particular string.
So Excel has to basically scan trough the string column on the very left and check for "GE" for example. If it is successful in finding it, it has to refer to the cell in the same row that references the value and then add this value into the cell where it sums all the "GE" values.
I tried some different things already but I wasn't able to find a solution. I hope you can help me! :)
You'll have to use the SUMIF function. Enter it in every cell of column G where you want to see the result. As an example, G3 cell should be:=SUMIF(B3:B12,"GE", D3:D12)EDIT: You could also pick the value from F column to avoid typos in the function, so you can also do it like:=SUMIF(B3:B12,F3, D3:D12)

COUNTIF range exclude header

=COUNTIF('sheet'!A:A, "*Pdf*")
This formula gives me no problem in general, but because the word pdf is part of the header cell, it gives me a wrong value from what I am actually trying to count (the actual data)
Some people have suggested that I select the range by doing shift+ctrl+down arrow, and it seems to work seamlessly for sum formula, (as in if I add in more values under the said range, it automatically adjusts the value) but when it is with countif, using that solution will not include any new data input.
The whole reason I want to have the range be the whole row is so that when new data gets added, the formula will automatically adjust itself.
So ultimately what I am trying to do is have the whole row selected as a range, except for the header cell (which in this case would be A1) Changing A:A to A2:A didn't work either.
This should do the trick
=COUNTIF('sheet'!$A2$:A, "*Pdf*")
=COUNTIF('sheet'!A:A, "*Pdf*")-1
This formula should work:
=COUNTIF($A$2:A, "pdf")

Excel Performance - INDEX-MATCH combination

I am using excel to create data sets that are used in a vba application later. I am using this formula:
=INDEX(BaseData!$L$2:$L$10000;MATCH(DataSet!D5&DataSet!E5&DataSet!K5;INDEX(B‌​aseData!$B$2:$B$10000&BaseData!$C$2:$C$10000&BaseData!$D$2:$D$10000;0);0))
usually with a range from f.ex.: A2 - A10000, because my data can be differently long and often vary in data selection.
However, this slows my excel extremely down. I switched to manual calculations, but then, when activating automatic again, my excel instance takes extremely long and often crashes.
I also tried to past some data, but when creating a new dataset, I have to pull the formula down again and sometimes through this errors occur in my data set.
Any suggestions what I can do to make the INDEX-MATCH formulas more performant?
I appreciate your replies!
UPDATE
I guess a lot of performance goes away because index-match does not select the exact range, but also counts in blank rows. How to get the exactl range with index match automatically?
As I mention in my comment above, as long as this is a 'regular' formula and not an Array Formula, you may find success simply replacing "A1:A10000" with "A:A". However barring that, you can create a cell which will calculate reference the number of rows of data which you have, and then use that cell to indirectly reference the complete column with data in it.
CALCULATING YOUR DESIRED RANGE
For the following example to work, I assume that: Column A includes an index key in the form of numbers only; Column A includes no numbers in the header and above; and that the index rows are continuous, with no breaks. Start with the following formula:
=COUNT(A:A)
If my assumptions above hold, then this will return the number of data elements in your table. Once we know where this data starts, we can use this COUNT to determine where it ends. Assume your header is in row 2. (I like to include the header so that if you insert a row beneath the header, Excel picks up that you want to include the new row in your formulas).With that in mind, this formula will create the Excel-style reference which finds the last cell in column A which has data in it:
=ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1)
Assuming 50 rows of data [which start at row 3, below the header], and all other assumptions above, this formula will return the text result "$A$53".
If you wanted to do the same thing, but instead return the full range in Column A where data exists (from the header to row 53), you could do as follows:
=ADDRESS(ROW(A2),COLUMN(A2),1,1)&":"&ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1)
This returns the text string result "$A$2:$A$53", which is a reference to the full index of unique ID values. It will automatically move around as you would generally expect if you insert any rows or columns. Now assume for your INDEX that you want to pull the same data, but for column B, instead. The formula will be exactly the same, except that where I have "COLUMN(A2)" above, replace with "COLUMN(B2)".
REFERENCING YOUR CALCULATED RANGE
So now you have the address of your proper, limited columns - but how do you actually reference those areas in a formula? By using the INDIRECT function. INDIRECT says "Evaluate some specific criteria. It will create a cell reference. Now look at that cell reference." In its simplest form, this could look like this:
=INDIRECT(A1)
Assume that A1 holds the value "B5". Indirect will pick up the value "B5", and instead of displaying "B5", it will go to B5, and pick up the value there. So to use this with the above, wrap the whole thing in the INDIRECT function. Instead of picking up the text string "$A$1:$A$53", it will actually now reference that range properly. Like so:
=INDIRECT(ADDRESS(ROW(A2),COLUMN(A2),1,1)&":"&ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1))
USING A NAMED RANGE
But that is a very long formula to have, and you won't want to use it within a specific cell for a simple INDEX/MATCH. Instead of entering these formulas in cells (although you could), I recommend you go to the Formula Ribbon -> Name Manager -> New Name. Call the name for the index of A "ID_COLUMN". Call the name for the index of "B_COLUMN" (or something more specific).
FINAL FORMULA
Now, if you wanted to make an INDEX/MATCH of your table, which automatically grows/shrinks as you change the data, your formula would look like this [this would, for example, pick the row from column B where column A has the number 100]:
=INDEX(ID_COLUMN,MATCH(100, B_COLUMN, 0))

Resources