Get value from another table using date reference and unique id

BradleyS

Active Member
Joined
Oct 28, 2006
Messages
351
Office Version
  1. 2010
Platform
  1. Windows
1721127611871.png


I need to show the latest value from sheet 2 in sheet1 column C
Only if the sheet2 date is >= the sheet1 date for the same id

I have highlighted the values in the sheet 1 table of column c to demonstrate the outcome I'm after.
The bit I'm struggling with in a formula is only using the latest date from sheet 2 for the unique id

Does anyone have any ideas on what formula I can use? Thank you
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
try this

Book1
ABCDEFG
1iddatevalueiddatevalue
2108/03/20240.2127/03/20240.2
3307/03/2024 127/03/20230.3
42522/04/20240.8306/02/20240.1
52325008/04/2024 2516/07/20240.8
62523/04/20240.7
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IF(MAX(IF($E$2:$E$6=A2, $F$2:$F$6))<B2,"",SUMIFS($G$2:$G$6,$E$2:$E$6,A2,$F$2:$F$6,MAX(IF($E$2:$E$6=A2, $F$2:$F$6))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution
Or this in the value column of sheet1. Obviously change cell references to suit.

=VLOOKUP(MAXIFS(Sheet2!B$2:B$6,Sheet2!A$2:A$6,$A2),Sheet2!B$2:C$6,2,FALSE)

Although just realised I missed the bit about sheet2 date >= sheet1 date.
 
Upvote 0
I'm still using Excel 2010 (I know!) so the MAX formula works for me. I would never have worked that one out.

If I wanted to use the earliest date from sheet 2 (as long as it was still after the date in sheet 1, what part of the formula would I need to change?
Is it the MAX to MIN?
 
Upvote 0
Changing MAX to MIN seems to have worked. I was just checking that I haven't missed anything.
 
Upvote 0
So instead try:
=IFERROR(VLOOKUP(MAXIFS(Sheet1!G$2:G$6,Sheet1!F$2:F$6,$A2,G$2:G$6,">="&$B2),Sheet1!G$2:H$6,2,FALSE),"")
 
Upvote 0
I was trying to enter the date from table 2 in column D by adjusting this formula:
=IF(MAX(IF($E$2:$E$6=A2, $F$2:$F$6))<B2,"",SUMIFS($G$2:$G$6,$E$2:$E$6,A2,$F$2:$F$6,MAX(IF($E$2:$E$6=A2, $F$2:$F$6))))

to this:
=IF(MAX(IF($E$2:$E$6=A2, $F$2:$F$6))<B2,"",SUMIFS($F$2:$F$6,$E$2:$E$6,A2,$F$2:$F$6,MAX(IF($E$2:$E$6=A2, $F$2:$F$6))))

but it sends back a strange date. What do I need to do to show the date of the matching value?
 
Upvote 0

Forum statistics

Threads
1,224,798
Messages
6,181,038
Members
453,014
Latest member
Chris258

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