Forum Discussion
FINDING TOTAL NUMBER OF DAYS
- Jan 02, 2021
On the basis of illustration by you above and what I've realized, trying to solve the issue, check the attached file and let me know whether is working or not!!
0MAS-.xlsb has been attached !!
- SkytalkerJan 13, 2021Copper Contributor
Should anyone care, A very smart individual, BEBO021999, from Vietnam, was able to apparently solve this problem with the following formula:
=IFERROR(INDEX($G:$G,AGGREGATE(15,6,ROW($A3:$A$13)/($A3:$A$13=$A2)/($D3:$D13>=$B2+IF($I2>=$H2,P$1,-P$1)),1))-$G2,"")
I am checking it with my files to see if works correctly, but so far it has done everything I was asking for. This is from another forum at: https://www.excelforum.com/excel-formulas-and-functions/1331382-number-of-days-it-took-a-stock-to-rise-sink-above-a-certain-level.html#post5453827
Thanks to ANYONE who tried to work on a formula that did what I requested.
- SkytalkerJan 09, 2021Copper Contributor
I have got part of my problem figured out using helper columns, but I am still having problems. I would still like to figure out a way to combine all formulas into 1, but I guess I will just have to take what I can get. The problem I am having is highlighted in yellow, such as K7, L7, etc.
The first problem is with the formula in K7: {=IF($H7>$I7,INDEX($C8:$C$50,MATCH(TRUE,$C8:$C$50<$J7,0)),IF($H7<$I7,INDEX($D8:$D$50,MATCH(TRUE,$D8:$D$50>$J7,0))))}
This formula is based on which cell is higher, H or I. If H is higher, it takes the value in J7 and looks down column C (LOW) and finds the next lower number. If I is higher, it takes the value in J7 and looks down column D (HIGH) and finds the next higher number.
I was trying to come up with a formula based on the following factors:
1 - What is in column A (SYM)
2 - Whether H or I is higher. This determines what goes in J7, which goes in K7, which determines the number we look up in column C or D, which determines what date goes in L7, which we will subtract from G7.
The problem is that at K7, we are looking for a value in column C, which is lower than J7 (115.40), but there aren't any lower, until we come to C18, which has a value of "AA" in column A.
I am trying to figure out a way to do the index/match that ONLY uses the value in column A as the limit which the formulas searches in column C or D, instead of 50 in $C8:$C$50. I want it to stop at row 18 because "AA" is the value, instead of "A". Although I can manually change $C8:$C$50 to $C8:$C$17, I don't want to do that over 3000 times, which is constantly changing. If I can figure this out, I believe it will fix the rest of the errors.
Of course, if anyone can figure how to combine these formulas, I would be VERY happy, as I have been trying to figure this out for months! I have to use 3 helper columns to find each value that goes under the # of days, i.e., 1,2,3,etc. That means an extra 30 columns!
If ANYONE is willing to try to help but are confused about what I am trying to accomplish, please ask me and I will strive to explain better.
- SkytalkerJan 08, 2021Copper Contributor
I checked the file you sent but I don't think you understand what I am trying to accomplish. Did you see my post that is 3 posts above your last post? I tried to explain what I was looking for. If possible, can you let me know if it makes what I need accomplished a little easier to understand. Thanks again for at least trying. I am trying to see if a mesh what you did into what I did, but I am still not doing very well. I just don't know enough about excel to get it done, but I will keep trying.