Complex Excel formula to return results from other pages within a spreadsheet

washhousescott

New Member
Joined
Feb 25, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I am trying to format a formula that will search for the last value in a column, then check to see if the corresponding value in a different column of the same row matches a given parameter. If it does, then I want to display the last value from the column, if it does not then I want it to show nothing. For example:

Sheet 1 has a list of Items from different sheets in the same workbook, Sheet 2 displays these items across columns and each item has Check In/Out dates. I want a formula on Sheet1 for each item that will perform the above action for each item on Sheet2. I have used various bots and have come close. The following formula, =INDEX('Sheet2'!B:B,COUNTA('Sheet2'!B:B)) , will always return the last value in the column but does not check for the "Date In" parameter. This formula, =IF(INDEX('Sheet2'!A:A,MATCH("Date In",'Sheet2'!A:A,0))="Date In",INDEX('Sheet2-GC'!B:B,MATCH("Date In",'Sheet2'!A:A,0)),"") checks for the "Date In" value first so will always return the first Check In date, not the latest.

The first attached image is an example of Sheet2, the second is what I expect the formula to accomplish.

Any assistance would be greatly appreciated.
 

Attachments

  • Screenshot_20230225_102703.png
    Screenshot_20230225_102703.png
    43.4 KB · Views: 33
  • Screenshot_20230225_103633.png
    Screenshot_20230225_103633.png
    18.4 KB · Views: 31

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the MrExcel forum!

If you only have 2 values in column A, you can try this:

Book1
ABCDEFGH
1Check In/OutITEM#01ITEM#02ITEM#03ITEMCheck Out
2Check In2/14/20173/27/20184/22/2017ITEM#0111/24/2022
3Check Out9/23/20175/27/20187/4/2017ITEM#027/25/2022
4Check In11/3/20186/14/201910/12/2018ITEM#03 
5Check Out12/27/20186/23/201912/4/2018
6Check In9/22/201910/11/202010/8/2019
7Check Out12/2/20194/2/202111/3/2020
8Check In4/12/20204/30/201211/25/2021
9Check Out8/12/20207/25/202212/3/2021
10Check In1/15/202112/2/2022
11Check Out5/15/2021
12Check In9/1/2022
13Check Out11/24/2022
14
15
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=LET(f,FILTER($B$2:$D$20,$B$1:$D$1=G2),IF(MOD(SUM(SIGN(f)),2)=0,MAX(f),""))
 
Upvote 0
Thanks for replying! I simplified the spread sheet a bit. It actually includes a row for the name of the person who checked out the item.

Territory Example.xlsx
ABCDE
1CHECK IN/OUTITEM#01ITEM#02ITEM#03ITEM#04
2NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
3CHECK IN02/14/1703/27/1804/22/1709/22/17
4CHECK OUT09/23/1705/27/1807/04/1705/14/18
5NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
6CHECK IN11/03/1806/14/1910/12/1805/19/19
7CHECK OUT12/27/1806/23/1912/04/1808/02/19
8NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
9CHECK IN09/22/1910/11/2010/08/1905/01/21
10CHECK OUT12/02/1904/02/2111/03/2010/01/21
11NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
12CHECK IN04/12/2004/30/2211/25/2109/02/22
13CHECK OUT08/12/2007/25/2212/03/21
14NAMEJ. SMITHJ. SMITHJ. SMITH
15CHECK IN01/15/2112/02/22
16CHECK OUT05/15/21
17NAMEJ. SMITH
18CHECK IN09/01/22
19CHECK OUT11/24/22
Sheet2
 
Upvote 0
I'm not sure if that actually makes it simpler. Good spreadsheet design usually suggests that there should only be one type of data in each column. Otherwise formulas referencing that column have to take into account multiple types of data, and that makes them more complicated. However, from a usability standpoint, maybe it makes it easier for you to work with, and in this case the formula doesn't have to change much:

Book1
ABCDEFGH
1CHECK IN/OUTITEM#01ITEM#02ITEM#03ITEM#04ITEMCheck Out
2NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHITEM#0111/24/2022
3CHECK IN2/14/20173/27/20184/22/20179/22/2017ITEM#027/25/2022
4CHECK OUT9/23/20175/27/20187/4/20175/14/2018ITEM#03 
5NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHITEM#04 
6CHECK IN11/3/20186/14/201910/12/20185/19/2019
7CHECK OUT12/27/20186/23/201912/4/20188/2/2019
8NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
9CHECK IN9/22/201910/11/202010/8/20195/1/2021
10CHECK OUT12/2/20194/2/202111/3/202010/1/2021
11NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITH
12CHECK IN4/12/20204/30/202211/25/20219/2/2022
13CHECK OUT8/12/20207/25/202212/3/2021
14NAMEJ. SMITHJ. SMITHJ. SMITH
15CHECK IN1/15/202112/2/2022
16CHECK OUT5/15/2021
17NAMEJ. SMITH
18CHECK IN9/1/2022
19CHECK OUT11/24/2022
20
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=LET(f,INDEX($B$2:$E$20,0,MATCH(G2,$B$1:$E$1,0)),IF(MOD(COUNT(f),2)=0,MAX(f),""))
 
Upvote 0
Solution
I'm sorry, I meant I simplified it for my first post. The second is an accurate reproduction. Would this formula update dynamically as more dates are added to each column?
 
Upvote 0
It's a good idea to make your question as close to your actual situation as possible. Even a small difference can make an answer not work right.

And yes, the formula will update dynamically as you add more dates, as long as you make the first range include as many blank rows at the end as you think you may need, $B$2:$E$200 for example. Change the E column to include all the ITEMs you have, and you can leave blank columns there too.
 
Upvote 0
Thanks so much for your help! I hate to bother you, but if I wanted a similar formula, but wanted to match the DATE OUT value in column A, how would I adjust the formula?
 
Upvote 0
I'm confused. There isn't a DATE OUT value in column A. If you mean CHECK OUT, that's is what already is out. Have you changed the layout of your sheet? If so, what does it look like now?
 
Upvote 0
I am so sorry! I created a redacted version of one of the sheets and was not paying attention to the IN/OUT column. I have included the actual layout of the sheet. I will say, even though the IN/OUT rows were switched previously, the formula you provided still worked. I'm not sure why since I don't understand the formula, but I appreciate your time and assistance regardless. The formula I mentioned for the OUT value is because I want to perform a check to see if a particular item has been checked out for longer than a set period of time (3 months). If so, then it would only need to return the date the item was checked out, otherwise it would be blank. I would like to pair that with a formula to return the name of the person who last checked out the item, if possible.

I understand I am asking for a lot, and would not be upset if I need to look elsewhere for this level of assistance.

Territory Example.xlsx
ABCDEFGHI
1DATE IN/OUTITEM#01ITEM#02ITEM#03ITEM#04ITEM#05ITEM#06ITEM#07ITEM#08
2NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITH
3DATE OUT02/14/1703/27/1804/22/1709/22/1701/12/1809/12/1707/27/1701/17/17
4DATE IN09/23/1705/27/1807/04/1705/14/1804/07/1812/17/1709/13/1709/19/17
5NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITH
6DATE OUT11/03/1806/14/1910/12/1805/19/1903/12/1909/24/1805/10/1810/21/18
7DATE IN12/27/1806/23/1912/04/1808/02/1904/05/1902/27/1907/15/1802/26/19
8NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITH
9DATE OUT09/22/1910/11/2010/08/1905/01/2101/12/2011/17/1908/07/1901/03/20
10DATE IN12/02/1904/02/2111/03/2010/01/2103/20/2002/12/2009/15/1903/10/20
11NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITH
12DATE OUT04/12/2004/30/2211/25/2109/02/2205/02/2108/12/2110/02/2005/02/21
13DATE IN08/12/2007/25/2212/03/2105/26/2111/02/2103/09/2105/22/21
14NAMEJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITHJ. SMITH
15DATE OUT01/15/2112/02/2209/13/2210/06/2205/13/2205/08/22
16DATE IN05/15/2112/20/2212/20/2208/03/22
17NAMEJ. SMITH
18DATE OUT09/01/22
19DATE IN11/24/22
Sheet2
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top