SOLVED

FINDING TOTAL NUMBER OF DAYS

%3CLINGO-SUB%20id%3D%22lingo-sub-2017204%22%20slang%3D%22en-US%22%3EFINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017204%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20actually%20submitted%20this%20problem%20to%202%20other%20forums%2C%20but%20haven't%20had%20any%20luck%20solving%20it.%20If%20it%20is%20unsolvable%2C%20can%20someone%20please%20let%20me%20know.%20When%20I%20began%20working%20on%20this%2C%20I%20thought%20it%20was%20going%20to%20be%20easy...just%20a%20matter%20of%20a%20few%20IF%20formulas%2C%20but%20I%20couldn't%20figure%20it%20out.%20I%20am%20trying%20to%20learn%20Excel%20and%20I%20took%20this%20on%20as%20a%20learning%20exercise.%20Although%20I%20have%20learned%20quite%20a%20bit%20while%20researching%20the%20problem%2C%20I%20still%20haven't%20solved%20it.%20I%20thought%20I%20had%20come%20close%20using%20Arrays%2C%20but%20my%20laptop%20crashed%20and%20I%20lost%20my%20formula%2C%20along%20with%2010%20pages%20of%20other%20formulas%20that%20did%20not%20work.%20I%20keep%20track%20of%20each%20formula%20I%20try%20and%20the%20results.%20I%20have%20explained%20what%20I%20am%20attempting%20to%20accomplish%20in%20the%20file%26nbsp%3B12-01-.%20I%20am%20looking%20for%20ANY%20ideas%20how%20to%20figure%20it%20out.%20Thanks%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EP.S.%20I%20am%20using%20Excel%202019.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2017204%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2017321%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017321%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F911948%22%20target%3D%22_blank%22%3E%40Skytalker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20examined%20both%20the%20sheets%20and%20came%20to%20the%20conclusion%20that%2012-01%20is%20summary%20of%20MAS%2C%20if%20so%20there%20is%20no%20match%20between%20source%20data%20(MAS)%20and%20the%20summary%20(12-01)%2C%2C%2C%20let%20me%20say%20Y%2C%2C%2C%20lowest%20for%20A%20is%20MAS%20is%20116.74%20%26amp%3B%20highest%20is%20119.23%20so%20unable%20to%20understand%20that%20how%20U%20got%20values%20in%20Row%202%20of%2012-01%2C%2C%2C%20and%20the%20date%2012-1%20in%20G2%20is%20clueless%20!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20exercise%20you%20are%20trying%20to%20accomplice%20are%20not%20properly%20described%20%26amp%3B%20reflects%20a%20complicated%20questions!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20my%20suggestions%20are%2C%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EShow%20us%20Few%20Source%20data%20and%20the%20Expected%20results%20then%20finding%20difference%20of%20days%20will%20become%20logically%20much%20easier%20%2C%2C%20for%20example%20this%20is%20what%20%3CEM%3E%22%231%20-%20Find%20if%20A2%20is%20in%20OMAS%3D%20or%20not.%20If%20not%2C%20then%20leave%20the%20cell%20blank.%20If%20it%20is%2C%20then%3A%22%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I've%20realized%20that%2C%20you%20are%20trying%20to%20fine%20the%20lowest%20and%20highest%20of%20each%20symbol%2C%20also%20the%20difference%20of%20days%20between%20lowest%20and%20highest%20and%20possibly%20the%20difference%20between%20the%20lowest%20and%20highest%2C%2C%2C%20if%20so%20pleas%20reply%20this%20post.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2017443%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017443%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20replying%20Rajesh-S.%20I%20think%20that%20may%20be%20my%20biggest%20problem...not%20doing%20a%20very%20good%20job%20of%20describing%20what%20I%20want.%20I%20just%20found%20out%20that%20OMAS-%20file%20was%20incorrect%2C%20so%20I%20corrected%20it%20and%20uploaded%20it%20in%20my%20original%20post%2C%20so%20if%20you%20downloaded%20my%20original%20file%2C%20please%20download%20the%20updated%20file.%20I%20will%20try%20to%20explain%20what%20I%20am%20trying%20to%20accomplish%3A%3C%2FP%3E%3CP%3Ein%20cell%20K2%20of%2012-01-%20%3A%3C%2FP%3E%3CP%3ESYMBOL%20%3D%20A%3B%20H2%20is%20less%20than%20I2%2C%20so%20if%20B2%2B1%20(116.36%20or%20higher)%20is%20found%20in%20Column%20D%20in%20OMAS-%2C%20which%20it%20is%20in%20cell%20D6%20(116.44)%2C%20I%20take%20the%20date%20in%20G6%20and%20subtract%20G1%20from%2012-01-%2C%20thus%2012%2F07%20-%2012%2F01%20%3D%206%20days%2C%20which%20goes%20in%20K2.%3CBR%20%2F%3EDoes%20this%20make%20it%20any%20clearer%3F%20Please%20advise%20me%20of%20which%20part%20you%20are%20having%20difficulty%20understanding%20and%20I%20will%20try%20my%20best%20to%20explain%20it.%20Also%20be%20advised%20that%20the%20original%20OMAS%20file%20is%20over%20287K%20and%20the%2012-01%20file%20is%20676%20rolls.%20I%20don't%20know%20if%20that%20will%20make%20any%20difference%20or%20not.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2018006%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2018006%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F911948%22%20target%3D%22_blank%22%3E%40Skytalker%3C%2FA%3E%26nbsp%3BPlayed%20around%20with%20Power%20Query%20a%20bit.%20Although%20your%20example%20looks%20for%2015%20different%20increases%2Fdecreases%20(from%201%24%20to%2015%24)%2C%20I%20created%20a%20set%20of%20queries%20that%20gives%20only%20the%20first%20three.%20If%20this%20is%20indeed%20what%20you%20want%2C%20you%20can%20expand%20the%20%22mySelection%22%20query%20to%20add%2012%20more%20calculations.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20keep%20it%20all%20a%20bit%20easier%20to%20work%20with%20I%20copied%20the%20OMAS%20table%20into%20the%2012-01%20workbook.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20end%20result%20looks%20like%20this%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-12-28%20at%2014.41.44.png%22%20style%3D%22width%3A%20323px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243063iFFDF8DC47A0ED8D1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-12-28%20at%2014.41.44.png%22%20alt%3D%22Screenshot%202020-12-28%20at%2014.41.44.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EResults%20are%20grouped%20depending%20on%20whether%20you%20want%20to%20count%20up%20(%2B1%2C%2B2%2C%2B3)%20or%20down%20(-1%2C-2%2C-3)%20and%20the%20number%20of%20days%20is%20always%20given%20as%20a%20positive.%20So%20it's%20not%20exactly%20what%20you%20asked%20for%2C%20but%20in%20principle%20its%20the%20same.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20I%20did%20not%20try%20to%20make%20it%20beautiful.%20Just%20wanted%20to%20demonstrate%20that%20it%20%3CSTRONG%3Emight%3C%2FSTRONG%3E%20work%20with%20Power%20Query.%20Perhaps%20a%20real%20PQ%20wizard%20can%20achieve%20a%20better%20result.%20But%20that's%20not%20me.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2019133%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2019133%22%20slang%3D%22en-US%22%3EThanks%20so%20much%20Riny.%20I%20will%20check%20it%20out.%20I%20tried%20using%20Power%20Query%20and%20couldn't%20get%20it%20to%20work%2C%20but%20you%20seemed%20to%20have%20gotten%20further%20than%20I%20did.%20I%20will%20see%20if%20I%20can%20improve%20on%20your%20work.%20Thanks%20again.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2026370%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2026370%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F911948%22%20target%3D%22_blank%22%3E%40Skytalker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20basis%20of%20illustration%20by%20you%20above%20and%20what%20I've%20realized%2C%20trying%20to%20solve%20the%20issue%2C%20check%20the%20attached%20file%20and%20let%20me%20know%20whether%20is%20working%20or%20not!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2027274%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2027274%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F93699%22%20target%3D%22_blank%22%3E%40Rajesh-S%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20a%20lot%20for%20spending%20your%20time%20trying%20to%20solve%20my%20problem.%20I%20was%20trying%20to%20use%20helper%20columns%20also%2C%20but%20I%20just%20couldn't%20get%20my%20formulas%20to%20work%20correctly.%20You%20ALMOST%20understand%20what%20I%20was%20trying%20to%20accomplish%2C%20but%20not%20quite%3A%3C%2FP%3E%3CP%3EL2%20is%20correct.%20If%20H2%20is%20lower%20than%20I2%2C%20I%20want%20to%20buy%20stock%2C%20BUT%20I%20want%20to%20see%20how%20many%20days%20it%20took%20for%20the%20stock%20to%20reach%20benchmark%2C%20i.e.%2C%20116.36%20%3D%201%2C%20117.36%20%3D%202%2C%20118.36%20%3D%203%2C%20etc.%20Once%20the%20stock%20got%20above%20116.36%2C%20which%20occurred%20on%2012%2F7%2C%20I%20want%20to%20subtract%2012%2F7-12%2F1%20(G2)%2C%20which%20is%206.%20Once%20it%20got%20above%20117.36%2C%20which%20it%20did%20on%2012%2F20%2C%20it%20would%20be%209%20(G9-G2)%2C%20etc.%3C%2FP%3E%3CP%3EI%20like%20what%20you%20did%20in%20O2%2C%26nbsp%3B%3DIFERROR(DATEDIF(%24G%242%2CN2%2C%22d%22)%2C%22%22).%20I'm%20going%20to%20see%20if%20I%20can%20find%20my%20old%20files%20with%20my%20helper%20columns%20and%20see%20if%20I%20can%20get%20it%20to%20work%20with%20them.%20If%20you%20are%20still%20confused%2C%20please%20do%20not%20hesitate%20to%20ask%20me.%3C%2FP%3E%3CP%3EAgain%2C%20thanks%20so%20much%20for%20taking%20time%20out%20of%20your%20day%20to%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2031580%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2031580%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F911948%22%20target%3D%22_blank%22%3E%40Skytalker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20able%20to%20find%20some%20earlier%20work%20that%20I%20had%20thought%20I%20had%20lost%20when%20my%20laptop%20crashed%20when%20I%20dropped%20it%2C%20but%20I%20was%20able%20to%20find%20it%20and%20rebuild%20it.%20Anyway%2C%20I%20hope%20you%20can%20understand%20what%20I%20am%20trying%20to%20accomplish%20and%20can%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2031726%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2031726%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F911948%22%20target%3D%22_blank%22%3E%40Skytalker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGlad%20to%20help%20you%2C%2C%2C%20I've%20tried%20my%20best%20to%20understand%20data%20illustration%20and%20your%20need%20and%20applied%20the%20possible%20method%2Fformula.%20Furthermore%20I%20would%20like%20to%20suggest%20create%20one%20small%20but%20meaningful%20compact%20sample%20data%20and%20below%20it%20show%20me%20your%20expected%20result%2C%20I'll%20try%20one%20more%20time%20to%20fix%20it%2C%20keep%20asking%20%E2%98%BA%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2033963%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2033963%22%20slang%3D%22en-US%22%3ERajesh%2C%20Did%20you%20attach%20a%20file%20to%20show%20me%20what%20you%20accomplished%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2035049%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2035049%22%20slang%3D%22en-US%22%3EYes%20I%20did%2C%2C%20check%20my%20post%20above%20the%20file%3CBR%20%2F%3E0MAS-.xlsb%20has%20been%20attached%20!!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2044724%22%20slang%3D%22en-US%22%3ERe%3A%20FINDING%20TOTAL%20NUMBER%20OF%20DAYS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2044724%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F93699%22%20target%3D%22_blank%22%3E%40Rajesh-S%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20the%20file%20you%20sent%20but%20I%20don't%20think%20you%20understand%20what%20I%20am%20trying%20to%20accomplish.%20Did%20you%20see%20my%20post%20that%20is%203%20posts%20above%20your%20last%20post%3F%20I%20tried%20to%20explain%20what%20I%20was%20looking%20for.%20If%20possible%2C%20can%20you%20let%20me%20know%20if%20it%20makes%20what%20I%20need%20accomplished%20a%20little%20easier%20to%20understand.%20Thanks%20again%20for%20at%20least%20trying.%20I%20am%20trying%20to%20see%20if%20a%20mesh%20what%20you%20did%20into%20what%20I%20did%2C%20but%20I%20am%20still%20not%20doing%20very%20well.%20I%20just%20don't%20know%20enough%20about%20excel%20to%20get%20it%20done%2C%20but%20I%20will%20keep%20trying.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I have actually submitted this problem to 2 other forums, but haven't had any luck solving it. If it is unsolvable, can someone please let me know. When I began working on this, I thought it was going to be easy...just a matter of a few IF formulas, but I couldn't figure it out. I am trying to learn Excel and I took this on as a learning exercise. Although I have learned quite a bit while researching the problem, I still haven't solved it. I thought I had come close using Arrays, but my laptop crashed and I lost my formula, along with 10 pages of other formulas that did not work. I keep track of each formula I try and the results. I have explained what I am attempting to accomplish in the file 12-01-. I am looking for ANY ideas how to figure it out. Thanks in advance.

 

P.S. I am using Excel 2019.

13 Replies

@Skytalker 

I've examined both the sheets and came to the conclusion that 12-01 is summary of MAS, if so there is no match between source data (MAS) and the summary (12-01),,, let me say Y,,, lowest for A is MAS is 116.74 & highest is 119.23 so unable to understand that how U got values in Row 2 of 12-01,,, and the date 12-1 in G2 is clueless !!

 

The exercise you are trying to accomplice are not properly described & reflects a complicated questions!!

 

So my suggestions are,,

 

Show us Few Source data and the Expected results then finding difference of days will become logically much easier ,, for example this is what "#1 - Find if A2 is in OMAS= or not. If not, then leave the cell blank. If it is, then:"

 

What I've realized that, you are trying to fine the lowest and highest of each symbol, also the difference of days between lowest and highest and possibly the difference between the lowest and highest,,, if so pleas reply this post.

 

 

 

Thanks for replying Rajesh-S. I think that may be my biggest problem...not doing a very good job of describing what I want. I just found out that OMAS- file was incorrect, so I corrected it and uploaded it in my original post, so if you downloaded my original file, please download the updated file. I will try to explain what I am trying to accomplish:

in cell K2 of 12-01- :

SYMBOL = A; H2 is less than I2, so if B2+1 (116.36 or higher) is found in Column D in OMAS-, which it is in cell D6 (116.44), I take the date in G6 and subtract G1 from 12-01-, thus 12/07 - 12/01 = 6 days, which goes in K2.
Does this make it any clearer? Please advise me of which part you are having difficulty understanding and I will try my best to explain it. Also be advised that the original OMAS file is over 287K and the 12-01 file is 676 rolls. I don't know if that will make any difference or not.

@Skytalker Played around with Power Query a bit. Although your example looks for 15 different increases/decreases (from 1$ to 15$), I created a set of queries that gives only the first three. If this is indeed what you want, you can expand the "mySelection" query to add 12 more calculations.

 

To keep it all a bit easier to work with I copied the OMAS table into the 12-01 workbook.

 

The end result looks like this:

Screenshot 2020-12-28 at 14.41.44.png

Results are grouped depending on whether you want to count up (+1,+2,+3) or down (-1,-2,-3) and the number of days is always given as a positive. So it's not exactly what you asked for, but in principle its the same.

 

Now, I did not try to make it beautiful. Just wanted to demonstrate that it might work with Power Query. Perhaps a real PQ wizard can achieve a better result. But that's not me.

Thanks so much Riny. I will check it out. I tried using Power Query and couldn't get it to work, but you seemed to have gotten further than I did. I will see if I can improve on your work. Thanks again.
best response confirmed by Skytalker (Occasional Contributor)
Solution

@Skytalker 

 

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!!

@Rajesh-S 

 

Thanks a lot for spending your time trying to solve my problem. I was trying to use helper columns also, but I just couldn't get my formulas to work correctly. You ALMOST understand what I was trying to accomplish, but not quite:

L2 is correct. If H2 is lower than I2, I want to buy stock, BUT I want to see how many days it took for the stock to reach benchmark, i.e., 116.36 = 1, 117.36 = 2, 118.36 = 3, etc. Once the stock got above 116.36, which occurred on 12/7, I want to subtract 12/7-12/1 (G2), which is 6. Once it got above 117.36, which it did on 12/20, it would be 9 (G9-G2), etc.

I like what you did in O2, =IFERROR(DATEDIF($G$2,N2,"d"),""). I'm going to see if I can find my old files with my helper columns and see if I can get it to work with them. If you are still confused, please do not hesitate to ask me.

Again, thanks so much for taking time out of your day to help.

@Skytalker 

I was able to find some earlier work that I had thought I had lost when my laptop crashed when I dropped it, but I was able to find it and rebuild it. Anyway, I hope you can understand what I am trying to accomplish and can help.

@Skytalker 

 

Glad to help you,,, I've tried my best to understand data illustration and your need and applied the possible method/formula. Furthermore I would like to suggest create one small but meaningful compact sample data and below it show me your expected result, I'll try one more time to fix it, keep asking ☺

Rajesh, Did you attach a file to show me what you accomplished?
Yes I did,, check my post above the file
0MAS-.xlsb has been attached !!

@Rajesh-S 

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.

@Skytalker 

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.

@Skytalker 

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-ri...

Thanks to ANYONE who tried to work on a formula that did what I requested.