Extract unique value between two dates based on multiple occurrences of a unique ID

undefeatedbrowns

New Member
Joined
Oct 3, 2018
Messages
1
Hi,

I'm trying to extract the dividend rate for a stock(ticker) from a data spreadsheet but I only need the dividend rate if the dividend's ex date and pay date fall before and after a certain date.

In the "data" spreadsheet, in column A I have a list of tickers or unique IDs but there can be multiple instances of the unique ID if the stock paid multiple dividends during the year. In column C is the dividend rate, column D is the ex-date and column E is the pay date.

In my output spreadsheet I have a ticker and I'm trying to write a formula that would pull the dividend rate if the ex-date is less than or equal to a date in my output spread sheet (cell A3) and the pay date is greater the date in my output spreadsheet (cell A3).
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
This formula assumes that the table on your 'data' sheet has headers in row 1 and that your data is in rows 2:30. On your output sheet, it assumes that your ticker is in cell A5 and your desired result is in cell B5. Put this formula in cell B5:

=SUMPRODUCT(--(Data!$A$2:$A$30=Output!$A5),--(Data!$D$2:$D$30<=Output!$A$3),--(Data!$E$2:$E$30>Output!$A$3),Data!$C$2:$C$30)

To understand what this is doing... the first section references the column of tickers on your data sheet, which need to match cell A5 on your Output sheet. The second section references Ex Dates and the 3rd section references Pay Dates. Finally, the last section returns the SUM of values where all of the criteria are met.

Caution... If the ticker, dividend rate ex date and pay date are listed more than once on your data sheet, the formula will return the sum of them, not the dividend rate.

Hope this helps.

jim
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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