I am trying for a while to pull data for around 160 metrics for the last imported date and previous one so I can automate some stuff.
This is how my datatable looks like:
I get the latest date from the table with a MAX function and the previous one with substantiating 7 days from the last one.
I would like to get the metrics for these two dates all the way to the end of the datatable without showing any zeroes (just leave blank where the entry is blank)
Problems are: 1-the data is formatted as datatable because a lot of graphs are feeding from it automatically. Since its a datatable it doesnt pull the right value from normal cell references of vlookup. 2-since its a datatable its hard to enforce +1 increment in columns for vlookup so that I dont have to manually type in 165 formulas. 3-I would really like a formula not to give zero when the entry is blank but also return blank.
I tried:
=VLOOKUP($C$3,$C$13:$FH$200,D:D, FALSE)
=VLOOKUP($C$3,Table1[#All],2, FALSE)
=INDEX(Table1[Date],MATCH($C$2,Table1[BOADPMOUS106]))
and a lot of variations of those. None of them works well or was able to be pulled to the end of the table. And of course they return 0 with blank entries.
Is anyone having an idea to solve this?
If you are returning a text based result, you can append a zero-length string to the VLOOKUP function.
=VLOOKUP($C$3,Table1[#All],2, FALSE)&""
This will not alter the string returned but will not show a zero when the return value would be blank.
If you are returning numbers or dates then you have to check if the return value is blank.
=IF(LEN(VLOOKUP($C$3,Table1[#All],2, FALSE)), VLOOKUP($C$3,Table1[#All],2, FALSE), "")
Unfortunately, this is a double lookup much as we had to do to check for errors before the IFERROR function came along but so far, there is no native worksheet IFBLANK function.
A UDF IFBLANK could be easily written.
If you are sure that you only return numbers or empty cells, this would prevent a double lookup:
=IFERROR(VALUE(A1&" "),"")
In your case, substitute A1
with VLOOKUP($C$3,Table1[#All],2, FALSE)
来源:https://stackoverflow.com/questions/36438998/pulling-data-from-big-excel-datatable-with-incremental-column-in-vlookup-or-inde