Counting up row and counting how many days until threshold is reached

worldCurrencies

New Member
Joined
Mar 7, 2022
Messages
17
Office Version
  1. 365
Platform
  1. Windows
In column A, I have dates from newest date to oldest date. In B i have prices. In C i have the max price. In D I have change between price and peak price in terms of currency. In E i have the change from peak as a percent, but ONLY if the change in peak was -20% or less. F is the amount needed to be recovered(half of what was lost).

I am trying to calculate in column G the amount of days to recover half of what was lost. so for example, in row 20, A(Date) = 1/1/2015, B(Current Price) = $100, C(Peak Price) = $200, D($ Change) = -$100, E(% Change) = -50%. F(Amount to Recover) = $50. G is counting the dates in column A until the prices in Column B = $150 (because current price of 100 plus the amount needed to be recovered of $50). However because the dates are in descending order, the formula would need to count the dates going up the column until it sees the column B price of $150.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
how about an index match - to find the date of that value and then subtract from the date

=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))

you may need to add 1 to include the date in cell
=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))+1

assuming i understand all the text description - a sample woul dbe much better here, i can see quite a few errors possible depending on data - ie - will the value looking for always be exact - can the value appear more than once - in which case it will get the oldest value and not the latest

Book3
ABCDEFG
1datepriceamount recoverdays
27/24/22360
37/25/22330
47/26/22300
57/27/22270
67/28/22240
77/29/22210
87/30/22180
97/31/22150
108/1/22120
118/2/22110
128/3/22105
138/4/22100505
Sheet2
Cell Formulas
RangeFormula
G13G13=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))+1
Cells with Data Validation
CellAllowCriteria
E2Custom=COUNTIF($D$2:$D$5,B2)=0


A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
 
Upvote 0
how about an index match - to find the date of that value and then subtract from the date

=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))

you may need to add 1 to include the date in cell
=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))+1

assuming i understand all the text description - a sample woul dbe much better here, i can see quite a few errors possible depending on data - ie - will the value looking for always be exact - can the value appear more than once - in which case it will get the oldest value and not the latest

Book3
ABCDEFG
1datepriceamount recoverdays
27/24/22360
37/25/22330
47/26/22300
57/27/22270
67/28/22240
77/29/22210
87/30/22180
97/31/22150
108/1/22120
118/2/22110
128/3/22105
138/4/22100505
Sheet2
Cell Formulas
RangeFormula
G13G13=A13-INDEX($A$2:$A$13,MATCH(B13+F13,$B$2:$B$13,0))+1
Cells with Data Validation
CellAllowCriteria
E2Custom=COUNTIF($D$2:$D$5,B2)=0


A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
Hi, thank you for your input. I am about to upload an image to help with this. I tried your formula in column I. I think some problems are: your dates are in ascending order and that it is looking for exact, as you mentioned. I am looking for descending order and whenever that threshold is met of price + recovery. However, I appreciate the response!!! Thank you!!
 

Attachments

  • Capture.PNG
    Capture.PNG
    60.7 KB · Views: 8
Upvote 0
as mentioned images are difficult to use
can you use xl2bb or a share as detailed - in my last post

also provide the example values expected and why - would help a lot here
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

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