+ Reply to Thread
Results 1 to 27 of 27

Finding a cell reference that contains specific value in a range

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Finding a cell reference that contains specific value in a range

    Good morning friends! (same to all others...)

    I am approaching a problem where I have a linear calendar from Jan 1 through Dec 31. As I am only concerned with the last 180 days' history, when we get to Dec 31 it simply starts back at it's beginning at Jan 1, much like a circle. I wish to total all the values that are, for example, two rows below the calendar for today and going back 180 days.

    In the following, any note of "***" Means: "Here I know I am presently lost and looking for an answer!"

    The present model I am working with would have me:

    1) Identify today's date -today()
    1a) Determine the cell reference that today's date is in and the cell two rows below it. ***
    2) Figure out if there are 180 days history in the current year - I suspect some simple subtraction
    3) If so, determine the cell reference of that day and the cell reference for the cell two rows down: ***
    3a) Total the cells from step 1a through step 3
    4, and so forth: All would be based on simple computations as to days past to be included and days backwards from the last (Dec 31) position to be included.

    Because I am re-aquainting myself with Excel, I suspect there are much more elegant ways to handle this. I would truly appreciate any ideas that I can learn from!

    As always has been the case throughout all the years you folks have helped me, on this board and a few others, Thank-You; and Merry Christmas!

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    A workbook with sample data would go a long way.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Dates are from F8 through NF8, Values I would want to total would be entered prior in F13 through
    nf13.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Something like this then? The elegance factor could possibly be improved using SUMIFS but I'm not on speaking terms with that function.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Have to get off to work very soon but looking forward to seeing how you accomplished this! Last night around 1:30am I came up with a concoction that I just have to finalize using a combination of TODAY(), MATCH(), OFFSET(), INDIRECT() and SUM(), along with some simple math, so as far as elegance, your solution is going to look like a formal state dinner compared to my square dance...

  6. #6
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Square dance in a spreadsheet doesn't sound that bad when you think about it...
    I'm a bit curious (and impressed) of your concoction since I doubt that I could solve the problem using the functions you mention.

    By the way, I forgot to mention that my formula is an array formula, you have to enter it with Ctrl + Shift + Enter.
    Did it solve your problem by the way? Or did I misinterpretate the task? Now that I think about it, it does seem a bit strange...
    Last edited by Jacc; 12-18-2013 at 06:56 AM.

  7. #7
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Sorry! I got hit with a flu the day after downloading the solution you posted and then paperwork from work piled up; still digging my way through.

    I NEED to look at how you handled for it MUST be more elegant than what I stuck together, but what I stuck together actually does work! I will post it probably tomorrow morning, just don't have me arrested using the code I wrote as evidence that I must be nuts.

  8. #8
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    You saved me quite a bit of embarrassment. Along the way, toying with different versions of this and modifying other areas, I made the mistake of carrying forward a version without this modification in it. Dang!

    OK, the excerpt is attached. You want to look at cell ND9. As far as the upper row with dates is concerned, I will be modifying it to reflect whatever year is current but keep the lineage from Jan 1 through Dec 31 stable, with then the only contortion to be displaying and modifications concerning accounting for leap year.

    If I have done this correctly we should have a file called xlxtract.xlsm available!

    Dang. Have to chase down a minor problem and see if it also manifests itself in other areas. I see that if the day immediately prior to today's date has an absence it does not get tallied. Probably will also hit the current date, and will have to check the other extremes...
    Attached Files Attached Files
    Last edited by brucemc777; 12-19-2013 at 01:44 PM. Reason: The "dang" remark-

  9. #9
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Good one indeed! A totally different approach that I think could work but at the moment it does not work I'm afraid. Or at least not the way I understood the task. I modified your formula and put the Today function in an external cell. Then I put a random date function in that cell. Hit F9 to generate a new random date. It should equal 180 regardless of date, shouldn't it?
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    I look forward now to not only seeing how you handled it, but also seeing how you tested it and figuring out what departed from my mental model!

  11. #11
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    I get a #Value error on the NC12 cell. Running MSO2010, we have both functions, though not hgihgly familiar with them other than it seems obvious what they do. Thoughts?

    Oh... had to change "01.01.2013" to "01/01/2013"... whoops...

    Must be in my section on when we have less than 180 days from today back to the first of the year. As I am definitely OC when it comes to these puzzles, I will first figure out where I blew it, correct it, then give myself the gift of your solution!
    Last edited by brucemc777; 12-20-2013 at 01:46 PM.

  12. #12
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Ok, I got your solution sorted as well. Shall I present the solution and disrupt your OC session so that you can focus on x-mas stress or would you rather want to carry on OC and forget about x-mas?
    Last edited by Jacc; 12-21-2013 at 06:25 AM. Reason: Deleting a few words that I forgot to delete and made no sens, breaking the rule of not editing after someone else posted.

  13. #13
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Let's not forget that i ain't that young any more AND I have four teen-age daughters...

    I was on the trail of the solution when I had to go to work (what a poor excuse to quit obsessing). I think the intelligent thing for me to do is graciously accept your help! Then I can go onto seeing how your solution works, and then onto the next problem involving importing sheets from another workbook, that other wb is always named the same thing but updated almost daily, and those sheets to overwrite the ones last imported...(Actually, I have a few nice examples I have been looking back at, but as before, work keeps interfering...).

  14. #14
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Four of them?! Wow. Cell phone charging has a real impact on the electrical bill in your home, eh?

    Turns out my "corrected" version of your version isn't 100%. 29 and 30 of june does not work. I put a spin button in there so one can click through those critical dates and see how it works (or rather how it doesn't work). It's a matter of playing around with the >= and the > and the 180 and 179 to make it work.
    As you can see your original setup was pretty close, it was just a matter of adding the 180-.

    Edit: Replacing the first >= with just > seems to reduce the error. Now there is only 1 day with 179 left to correct.
    Last edited by Jacc; 12-22-2013 at 03:06 AM.

  15. #15
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Thank-you; given the situation, though perhaps not technically correct, it is practically correct - the error is not material. Seems like you have provided me with both - a solution to my problem, and the opportunity for my O/C to still excersize when I have the time to ferret out the immaterial remaining difference; THANK-YOU!

  16. #16
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    A perfect imperfection?
    You are welcome!

  17. #17
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Though I insist on doing the OC thing and examining your modification of my solution, I have embraced your original solution, and I must again say "Thank-you!!!". May I ask what it was that told you to use an array formula I recall I once knew enough to employ such, and that was back when I had a better understanding of them. This has given me a refresher, but I am curious so I don't have to be as "creative" next time... (I am sure there will be a "next time"...)

  18. #18
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    If you look around this forum you will see that the array-formula type of solutions are very common. In fact, before I joined this forum I knew about array formulas but I had almost no experience of putting them to use. After a couple of hundred posts I was up to speed. A solution to a problem like yours does not come from scratch for me. I usually recognize that some parts of the problem can be solved with chunks of array formulas that I have used many times before. Basically I have a little library of array formula blocks in my head to choose from. Starting with these blocks I then figure out what functions I need to fill the gaps and make it all work. The dayno-of-the-year formula I could have figured out myself but I figured that an optimal one is only a google search away so I borrowed that from somewhere. If you look in the formula the dayno-of-the-year formula is used 5 times within the whole formula, both in array and non-array form.
    The Evaluate formula button (under the formulas tab) is a very useful tool when it comes to array formulas.

    Again, you are welcome!

  19. #19
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    I am trying to formulate how to convert the chart over to generic figures across the top line that had the dates of Jan 1 through Dec 31 so it will be for any year and then accommodate for leap year - the idea is that this is to be used for every year, not just 01/01/2013 through 12/31/2013. I am starting to see how it all works, but if I go from a table of dates to a table of text values I am wondering if I best instead of text values substitute a table of dates based on =DATE(YEAR(TODAY()),1,1), <previous cell> + 1, <previous cell> +1, ...
    Thoughts?

    Naw, that won't work for all the year will be converted to the new year once the next year comes about, but something to this effect should work...

    I strongly suspect the solution to a perpetual circular calendar in linear form that transitions to the next year when the displayed date would be 180 days or more less than TODAY() is with an array formula, but so far my mind can't wrap around it...
    Last edited by brucemc777; 12-29-2013 at 11:32 PM. Reason: Fix date sequencing

  20. #20
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    I am posting what I have come up with as the final piece of this puzzle for the calendar portion, and I hope it will fit into the accumulator equation graciously created for me by Jacc. Either of the two lines highlighted in yellow can work, but I still suspect there is a more elegant way to do this, probably with an array formula. If so, I sure would appreciate the logic in how to progress to a solution for I need to start thinking that way to learn and at some point teach others instead of begging for answers!


    As testimony to Jacc's accumulator, it seems to be handling anything weird I throw at it!
    Attached Files Attached Files
    Last edited by brucemc777; 12-30-2013 at 04:25 PM. Reason: Note accumulator

  21. #21
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    For reasons I am not yet able to fully understand (as I am still trying to understand the creation of array formulas, much more intense the dissection of what isn't going right with how one is running) ever since today() became 1/1/2014 and later the formula returns "0".

    I am looking at the formula specifically for how the current year impacts it, and since it is straight to the point it should be easy, but that only is if you already have a good handle on the array formula thinking - which I am disappointingly far from, even with the help of the formula evaluator.

    Can someone who does have a good understanding have a look? Tried to pm Jacc but apparently everyone else in the world also does so; mailbox is full!

  22. #22
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    Quote Originally Posted by brucemc777 View Post
    As testimony to Jacc's accumulator, it seems to be handling anything weird I throw at it!
    Good to hear it works! I credit that to using day-no-of-the-year in my function a lot. That way different years and stuff don't confuse it.

    My posting in this thread has been interrupted for a while now, not only by x-mas but by work of all things! That means that I'm not really here now...
    Nevertheless, since word got around that you now got your arms around the array formulas I think it's time to mention the Evaluate Formula button that is located under the Formulas tab. The window is ridiculously small so in order to get something out of it I sometimes create a scaled down test version of a formula and run it there. It gives excellent insight in how array formulas work. It will also give you the opportunity to be confused on a whole new level, the inner workings of Excel is sometimes so obscure that you wish you never knew.

    I have yet to open one of your files and it will not happen tonight. I'm guessing weekend...

    Mailbox is full when it hits 70(!). Wasn't there a guy once that thought that no one would ever need more than 64k memory?

  23. #23
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    By the way, do NOT download, open and run this spreadsheet. http://spreadsheetpage.com/index.php...mula_calendar/

  24. #24
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Wow. I am going to have to study that code for some time and I still question if I will "get" it...

    If you have a moment, I had a question about another part of this dang project I am working on I posted. Would you be able to take a look at this post ? I have this feeling that the answer is horribly obvious, but I just can't put my finger on it, kind of like when you blank on just the right word...

  25. #25
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Both the formula cell at the far right (ND10) and the handling of dates(Row 5), which I admit was sort of "square-dance", but it seems to work...!
    Attached Files Attached Files

  26. #26
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding a cell reference that contains specific value in a range

    That SUMIFS formula is looking pretty darn good, your OC is progressing nicely! Your named formula is also pretty cool.

    The weekday you can get from the date. For instance in C3 type =C4 than format C3, choose Custom and type dddd but I would be surprised if you didn't already know that.

  27. #27
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Finding a cell reference that contains specific value in a range

    Ummmmmmmmmmmmmm, surprise?! I even completely forgot about that row... (Where is the "emoticon" for embarrassment when I need it...)

    Thank-you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 09-05-2012, 09:38 AM
  2. Finding Specific Value in Range
    By ExcelFinWizzard in forum Excel General
    Replies: 2
    Last Post: 07-10-2012, 11:27 AM
  3. [SOLVED] Finding cells staring with a specific value from a range
    By evertjvr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-21-2012, 02:29 AM
  4. Replies: 0
    Last Post: 01-29-2012, 10:05 PM
  5. Finding a particular cell reference among a range of cells
    By deathbybowtie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-12-2009, 04:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1