Let's say I've got a table like this
What I want to do is get a formula that always gets the last value in column B and put it on cell D1, so in this case I want to get the value "21" but then if I keep adding values to this list I want to always get the value placed in the last row on that list. is there a way to do this?
Found a way to do this.
=LOOKUP(2,1/(B:B<>""),B:B)
Sure. Use COUNTA(B:B) to count all the non-empty cells in column B, use ADDRESS() to build the address of the last cell and use INDIRECT() to pull the value of the said address.
or you can use INDEX() to combine indirect and address
Related
I can't figure out a function that would automatically copy the first row value if the value on another rows matches 1. I would need the red dates to be automated.
Any advice would be very appreciated, thank you!
Excel problem
You can do it with
=INDIRECT(ADDRESS(1; MATCH(1;E2:ZZ2)+4))
The inner MATCH searched for "1" in the given array (from E2 to ZZ2). The "+4" is there, because you are beginning to search in column E (=5) and MATCH returns the column within your array.
The ADDRESS takes the first row and the column found by MATCH.
The INDIRECT returns the value of the given ADDRESS.
If you copy this formula down the rows, the search array (E2:ZZ2) is automatically adjusted to search the corresponding row.
=INDEX($E$1:$O$1;1;MATCH(1;E2:O2;0))
Replace semicolon with comma if your Excel version needs it.
If you have, you can also use Xlookup, it's a bit easier.
=XLOOKUP(1;E2:O2;$E$1:$O$1;"not found")
I'd like to return a "u" if the cell to the left is in column I on my other tab AND if the cell underneath is in column F on the other tab. How would I go about this please?
So far I have in cell f7: =IFERROR(IF(VLOOKUP(F8,Table!I:I,1,0)<>"","u",0),"")
but I need to also look in Table!F:F to see if the date from the cell underneath is in it.
EXAMPLE
Here is my data in tab 1:
Here is what I'm looking to do in tab 2:
If I understand your question correctly this formula should provide what you are looking for.
=IFERROR(IF(AND(VLOOKUP(F8,Table!I:I,1,0)=F8,VLOOKUP(F9,Table!F:F,1,0)=F9),"u",0),"")
Using the AND() function requires both tests to be TRUE in order for the evaluations to be TRUE. An OR() allows both to be checked but returns TRUE if either is TRUE. So using the AND() checks both conditions and returns "u" in your IF statement only if both are TRUE.
I changed the logical criteria to equals just to be sure the values match.
Hi Becca,
It seems the part that I missed in the first attempt was the across. I think the vlookup is your easiest way to do this, but you may have to rearrange your columns. If you cut the column I:I on the table tab, and highlight column F:F right click and insert cut cells this will line the data up better for the vlookup. Now if you use the below formula you can compare across.
=IFERROR(IF(VLOOKUP(F8,Table!F:G,2,0)=F9,"u",0),"")
What this does is it finds the look up value and returns the value from the other column. Then it compares the returned value to the value in the cell underneath. If they match you get a "u" and if not, you get a "0". If the lookup is an error, you receive a blank.
Ok let's try this. A $ turns a relative reference into an absolute reference. The following looks up the name in column "A" and returns the date in column "B". It then compares that date to the value of row 10 of the current column. If it is drug across columns it will update to that column. If you wish to lock the column and unlock the row simply move the $ to before the "B" for the "B10" reference.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=B$10,"U",0),"")
[![enter image description here][3]][3]
If you only care that the date is in the list below you could use an HLOOKUP.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=HLOOKUP($B2,$10:$10,1,FALSE),"U",0),"")
Then you will have to use an index match however, this will not work on Excel 2019 or older. You will most likely need to use Excel 365. It will work best if you are always checking against the same reference (say B10), but you can drag it across.
=IFERROR(IF(INDEX(Table!$B:$B,MATCH($A2&B$10,Table!$A:$A&Table!$B:$B,0))=B$10,"u",0),"")
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.
I am trying to do something like this:
=SUMIF(H2:H55,VLOOKUP(insert placeholder for current row,Interfaces_to_Devices,5,FALSE)=A4,J2:J55)
IE I am trying to use the current row that I am evaluating to do a VLOOKUP of a value that needs to be equal to something I specify.
Thank you.
In this screen shot I did not include the VLOOKUP()="A4". That is supposed to be in there.
ROW() will return the number of the current row.
But the first argument to VLOOKUP is a cell reference or value.
If you explain what value you are trying to use in the VLOOKUP, how it is related to the current cell, then it is probably possible to use INDEX and MATCH (perhaps OFFSET) to achieve what you need.
=SUMIF(H2:H55,VLOOKUP(ROW(),Interfaces_to_Devices,5,FALSE)=A4,J2:J55)
Or
=SUMIF(H2:H55,INDEX(Interfaces_to_Devices,5,ROW())=A4,J2:J55)
If you simply REFERENCE the first value in column 5 of Interfaces_to_Devices, then drag down your formula you will simply reference each value going down the column without the need for a lookup, index, or match.
Notice in the picture below how i replace your formula with the cell reference to the 5th column in the table and in my first Row i Reference the first value in the column then as i drag the formula down it automatically references the equivalent cells in each row down the column.
I would like to use a VLOOKUP function referring to a data table placed in a different sheet from the one where the VLOOKUP function in written.
Example: in Sheet 1, cell AA3 I would like to insert the VLOOKUP function.
I want the function to check the number in cell M3, find the same number in Sheet 2 range address A2:Q47 first column, and reproduce the value in the 13th column of that table.
I've written this function but it reports #N/A as a result:
=VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
One of the common problems with VLOOKUP is "data mismatch" where #N/A is returned because a numeric lookup value doesn't match a text-formatted value in the VLOOKUP table (or vice versa)
Does either of these versions work?
=VLOOKUP(M3&"",Sheet1!$A$2:$Q$47,13,FALSE)
or
=VLOOKUP(M3+0,Sheet1!$A$2:$Q$47,13,FALSE)
The former converts a numeric lookup value to text (assuming that lookup table 1st column contains numbers formatted as text). The latter does the reverse, changing a text-formatted lookup value to a number.
Depending on which one works (assuming one does) then you may want to permanently change the format of your data so that the standard VLOOKUP will work
I faced this problem and when i started searching the important point i found is, the value u are looking up i.e M3 column should be present in the first column of the table u want to search
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
check in lookup_value
Your formula looks fine. Maybe the value you are looking for is not in the first column of the second table?
If the second sheet is in another workbook, you need to add a Workbook reference to your formula:
=VLOOKUP(M3,[Book1]Sheet1!$A$2:$Q$47,13,FALSE)
There might be something wrong with your formula if you are looking from another sheet maybe you have to change Sheet1 to Sheet2 ---> =VLOOKUP(M3,Sheet2!$A$2:$Q$47,13,FALSE) --- Where Sheet2 is your table array
This lookup only features exact matches. If you have an extra space in one of the columns or something similar it will not recognize it.
I have faced similar problem and it was returning #N/A. That means matching data is present but you might having extra space in the M3 column record, that may prevent it from getting exact value. Because you have set last parameter as FALSE, it is looking for "exact match".
This formula is correct: =VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
Copy =VLOOKUP(M3,A$2:Q$47,13,FALSE) to other sheets, then search for ! replace by !$, search for : replace by :$ one time for all sheets