Hi All,
I have the following raw data:
[TABLE="width: 479"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD][/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Material
[/TD]
[TD]Bill Date
[/TD]
[TD]Unit Price
[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]14/05/2018
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]03/05/2018
[/TD]
[TD]323
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]10/05/2018
[/TD]
[TD]300
[/TD]
[TD][/TD]
[TD]Material
[/TD]
[TD]Unit Price
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]28/05/2018
[/TD]
[TD]300
[/TD]
[TD][/TD]
[TD]A
[/TD]
[TD]323
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]02/06/2018
[/TD]
[TD]278
[/TD]
[TD][/TD]
[TD]C
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]16/06/2018
[/TD]
[TD]210
[/TD]
[TD][/TD]
[TD]R
[/TD]
[TD]500
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]21/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]22/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]27/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]29/01/2018
[/TD]
[TD]900
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]29/01/2018
[/TD]
[TD]900
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]29/03/2018
[/TD]
[TD]500
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]16/04/2018
[/TD]
[TD]490
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]19/04/2018
[/TD]
[TD]490
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]22/05/2018
[/TD]
[TD]470
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]25/05/2018
[/TD]
[TD]470
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]15/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]20/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]21/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Am trying to create a report as on 14th May 2018 where I need unit price corresponding to the nearest date.
Hence for “A” I must get unit price as 300 & “C” as 900 as that is last latest date (29/01/2018) & “R” as 490.
Am using “=IFERROR(VLOOKUP(F5,B2:D20,3,0), INDEX(C3:C20,MATCH(G2,D3:D20,-1)+1))”, however it gives me the very first value(unit price) for each material.
Any help is much appreciated.
Thanks
I have the following raw data:
[TABLE="width: 479"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD][/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Material
[/TD]
[TD]Bill Date
[/TD]
[TD]Unit Price
[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]14/05/2018
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]03/05/2018
[/TD]
[TD]323
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]10/05/2018
[/TD]
[TD]300
[/TD]
[TD][/TD]
[TD]Material
[/TD]
[TD]Unit Price
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]28/05/2018
[/TD]
[TD]300
[/TD]
[TD][/TD]
[TD]A
[/TD]
[TD]323
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]02/06/2018
[/TD]
[TD]278
[/TD]
[TD][/TD]
[TD]C
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]16/06/2018
[/TD]
[TD]210
[/TD]
[TD][/TD]
[TD]R
[/TD]
[TD]500
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]21/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]22/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]27/12/2017
[/TD]
[TD]1050
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]29/01/2018
[/TD]
[TD]900
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]29/01/2018
[/TD]
[TD]900
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]29/03/2018
[/TD]
[TD]500
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]16/04/2018
[/TD]
[TD]490
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]19/04/2018
[/TD]
[TD]490
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]22/05/2018
[/TD]
[TD]470
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]25/05/2018
[/TD]
[TD]470
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]15/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]20/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]R
[/TD]
[TD]21/06/2018
[/TD]
[TD]450
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Am trying to create a report as on 14th May 2018 where I need unit price corresponding to the nearest date.
Hence for “A” I must get unit price as 300 & “C” as 900 as that is last latest date (29/01/2018) & “R” as 490.
Am using “=IFERROR(VLOOKUP(F5,B2:D20,3,0), INDEX(C3:C20,MATCH(G2,D3:D20,-1)+1))”, however it gives me the very first value(unit price) for each material.
Any help is much appreciated.
Thanks