简体   繁体   中英

Read value on Sheet1 from Sheet2 using vlookup

I have the following on Sheet1:

工作表Sheet1

Then on Sheet2, I have data. Following is the image.

Sheet2中

I want to read the today's and tomorrow's for all the fruits from Sheet2 to Sheet1

I tried vlookup, but it didn't give me a right answer. It was confusing. I also tried to incorporate an if statement with the vlookup, but that made it more confusing.

If you data is consistent, you can use this formula =IF(C$2="Today",INDEX(Sheet2!$D$3:$D$800,MATCH($B3,Sheet2!$B$3:$B$800,0)),INDEX(Sheet2!$D$3:$D$800,MATCH($B3,Sheet2!$B$3:$B$800,0)+1)) in cell C3 . drag formula below whole table...

在此输入图像描述

Maybe there is way to match with blank cells in between, but the best practice is to fill out those blanks to save your time and make the formula clean, moreover, it is very easy with this trick:

First, highlight the column (ie. B1 to B6 ), and then go Home > Editing > Find & Select > Go To Special > Blanks > OK , = , upper arrow key , Ctrl + Enter . This way it will fill out all the blanks with the most available text in it.

Then you can perform this easy formula to do the subtotal task:

=SUMIFS($I$3:$I$13,$G$3:$G$13,$B3,$H$3:$H$13,C$2)

Please note that I put everything in the same tab to show you how this is being done. You should change those ranges accordingly based on your data setup. This way, you can have more data and different criteria be added on and still get the correct answer as I have shown you in the above screenshot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM