+ Reply to Thread
Results 1 to 31 of 31

Formula to add latest data input

  1. #1
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Formula to add latest data input

    If you have a simple formula in one cell to add the latest amounts in a column, for example the last 6 amounts imputed, can a formula be constructed so that when you add a further amount it updates?

    Basically last 10 weeks 5+6+3+4+3+4+5+3+1+9=43

    Formula adds last 6 weeks = 25

    Then another amount added, in this case 7

    Last 10 weeks 6+3+4+3+4+5+3+1+9+7=44

    Formula to add last 6 weeks = 29

    Is that possible?
    Last edited by Marvo; 12-11-2020 at 05:00 AM.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,911

    Re: Formula to add latest data input

    yes it is possible,
    please attach sample excel file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Sorry samba-ravi, haven't got one yet, wanted to know if it was possible. I'm also trying to incorporate a value to a letter, simply W=3, D=1. I'll make a mock-up sheet and post it.

  4. #4
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Okay. You're looking at Column J. What I'd like if possible is a total of the last 6 matches counting a W = 3 and D =1.

    A further improvement would be the 6 could be in a separate cell so it could be changed to say 8 or 10 if necessary that would be even better. Results are added each week.

    If you want to aim for a perfect outcome, having a further cell counting the last 6 games in League games only (Column I) would be the icing on the cake but I dont want to push my luck.

    Many thanks for your interest.
    Attached Files Attached Files

  5. #5
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Right, stage 1 completed. This is the formula I've come up with to add the letters together

    =SUM(COUNTIF(J5365:J5370,"W")*3+COUNTIF(J5365:J5370,"D")*1)

    So stage 2, when a result is entered into J5371, how do I get this formula to automatically change to

    =SUM(COUNTIF(J5366:J5371,"W")*3+COUNTIF(J5366:J5371,"D")*1)

    to represent the latest last 6 results? I'm guessing there has got to be a 6 somewhere?

    Maybe something to do with the entire row (J) but a number to indicate how far you go back?
    Last edited by Marvo; 12-10-2020 at 11:18 AM.

  6. #6
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Right I've moved on to stage 3 because I haven't got a scooby how to do stage 2. I've tried this

    =COUNTIFS(ALL!I:I="League",SUM(COUNTIF(ALL!J:J,"W")*3+COUNTIF(ALL!J:J,"D")*1)

    but it doesn't work, says I'm missing an opening or closing parenthesis. I put an extra closing one on the end of the above but that didn't work. Anybody?

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Once again, where am I supposed to be looking for this stuff?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  8. #8
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Post with attachment at 12:02.

    Started answering myself at 3:53.

    I'm not very good at this am I?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    The answer to 1 and 2 combined:

    =SUMPRODUCT(LOOKUP(INDEX($J:J,AGGREGATE(14,6,ROW($J$1:$J$10000)/($J$1:$J$10000={"W","D"}),{1,2,3,4,5,6})),{"D","W"},{1,3}))

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Last 6 League matches ONLY:

    =SUMPRODUCT(LOOKUP(INDEX($J:J,AGGREGATE(14,6,ROW($J$1:$J$10000)/(($I$1:$I$10000="League")*($J$1:$J$10000={"W","D"})),{1,2,3,4,5,6})),{"D","W"},{1,3}))

  11. #11
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Thanks Glenn,

    I've put that formula into a cell and its returning the value of 3. With 3 wins and 2 draws the last 6 games it should be 11?

    Looking at your formula, is the 1,2,3,4,5,6 the instruction to look back 6 rows??

    I'm trying to understand it.
    Last edited by Marvo; 12-10-2020 at 02:00 PM.

  12. #12
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    The league only formula also returns 3, should be 7.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    I think I have misunderstood you. You want the last 6 GAMES?? Please confirm. I was calculating the last 6 WINS or DRAWS.

  14. #14
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Yes Glenn, its for a current form. What I was aiming for was two cells, one with a formula to look back over an amount of games, the other cell with the amount of games. In that way I could put whatever figure I liked in the one cell and the formula would look back that amount of games to give me a points total.

    My Australian friend then will do a code where I can enter that points total and immediately discover the previous time that sequence was either better or worse.

    So, when asked the question, when was the last time we had such a good or poor run of results I can immediately say, Feb-April 1978 (for example). To actually find that out manually is nigh on impossible, there are not enough hours in the day.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Take a look here.

    I am confused by your expected answer for last 6 league games. Shouldn't it be 8???
    Attached Files Attached Files

  16. #16
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Yes Glenn, I did it in my head. Sorry.

  17. #17
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    That's great Glenn. Couple of questions. Is it where you write 1,2,3,4,5,6 in the formula where it is looking back at that amount of games? Also, do we need a value for "L" if it's zero?

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Yes... and Yes.

  19. #19
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Okay, thanks. I'll just have to change the formula when I need to or have a few, maybe 6 games, 10 games, 12, games, 15 games etc.

    That might not be as easy as I say. I just tried to copy the formula over to my master workbook and it immediately returned zero and even pressing the back button wouldn't return it to 8. I'll try writing the formula over manually.

    Thanks Glenn, you've been a great help and it's much appreciated.

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Dont. There is an alternative that'll be easier to maintain. I will look at it tomorrow.

  21. #21
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    I had some "issues" with your sample sheet. Try copy paste without the = and add it manually. Also check cell alignment. It caused me lots of issues on your sample sheet. I called you all sorts of ungentlemanly names...

  22. #22
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Okay Glenn, I probably deserve it.

    I've attached the actual workbook, your formulas have been transferred to K5418 & K5418 where you'll see they are giving an incorrect result.

    They will eventually be added to the Runs & form page. That page is under construction.

    Many thanks.
    Attached Files Attached Files

  23. #23
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,452

    Re: Formula to add latest data input

    With J5418 stores counting number, i.e, 6 or 7 or 10

    Try this:

    Please Login or Register  to view this content.
    How it works: assuming count number =6

    Get the last row index (5370), then minus 6, to get the starting row index (5365)
    LOOKUP(2,1/($J$2:$J$5400<>""),ROW($J$4:$J$5400))-$J$5418-1

    Sumup all rows with:

    1) row index>=5365
    2) column K> column L, count 1 then multifly by 3
    3) column K< column L, count 1

    The SUMPRODUCT(1*(2+3)) to add up every row with it own result (3 or 1)

    I hope this will help you in further requirement in your file.
    Attached Files Attached Files
    Quang PT

  24. #24
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988
    Quote Originally Posted by bebo021999 View Post
    With J5418 stores counting number, i.e, 6 or 7 or 10

    Try this:

    Please Login or Register  to view this content.
    How it works: assuming count number =6

    Get the last row index (5370), then minus 6, to get the starting row index (5365)
    LOOKUP(2,1/($J$2:$J$5400<>""),ROW($J$4:$J$5400))-$J$5418-1

    Sumup all rows with:

    1) row index>=5365
    2) column K> column L, count 1 then multifly by 3
    3) column K< column L, count 1

    The SUMPRODUCT(1*(2+3)) to add up every row with it own result (3 or 1)

    I hope this will help you in further requirement in your file.
    Thanks Bobo. Sadly I've got up this morning and I've encountered the dreaded blue screen so can't get into my computer. Looks like it will need to go for repair or I may have to buy a new one, either way I can't get at my documents for now. I will come back to this as soon as I'm able but that may not be for a couple of days.
    Thanks for the assistance.

  25. #25
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Morning all. This problem has now been solved by somebody who has constructed some code to do the job. Thanks for all the help.

  26. #26
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    The reason that they did not work is because you (for some reason) decided to enter them as array formulae, with CTRL-SHIFT-ENTER. Just use enter and they work fine.

  27. #27
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    The "some reason" Glenn is most of the time I don't know what I'm doing. I saw the { and thought that indicated an array formula. I'm sitting here now nervously waiting for the computer repair shop to open to see if I can salvage all my work, at least that what has been updated in the last month or so since my last back-up. Fingers crossed.

    Note: Thankfully I've downloaded two of my workbooks back off of the excel forum so all is not lost. Once again, thanks for your help.

  28. #28
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    Did the formula on your file with {} round it? I've recently upgraded to O365 and array entry is a thing of the past....

    Good luck with the PC! I back everything up to the cloud continuously. I got caught once. Once you make that mistake, you never make it again.

  29. #29
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    I'm sure I tried the formula with and without array but I did think it was an array. You're lucky if you no longer have to deal with it, if I have to as I suspect buy a new computer I'll try and make sure I get the very latest excel package. I don't use the cloud, back up to a hard drive but keep forgetting to do it. I last backed up possibly a couple of months ago so a lot of work will be lost. I'll have to look at how to back up my stuff daily. Maybe dropbox to my laptop?

    Ten minutes until the repair shop opens. I'm dreading the prognosis. It's not the cost, it's the lost time.

  30. #30
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Formula to add latest data input

    It's off topic, but... I have about 350Gb of music that is continuously backed up to Microsoft One Drive. It's quick to start when i boot up either the Desktop or Laptop. I have 150Gb of work-related files on Google Drive. It is slow to sync on boot-up. Maybe 15 mins. Ther PC is perfectly useable in that time. If both PC and Desktop are on, files sync instantaneously and I can pick up where I left off on either machine. I tend not to turn them off at night, but put them into sleep mode, to avoid the lengthy wait while Google Drive does its job.

    To prove my paranoia... I also back the desktop up to two separate external HDDs every week or so.

    As you may have gathered, when I got burned, I got burned badly. Never again!! Hope you don't have such an unpleasant lesson to learn!!

  31. #31
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    988

    Re: Formula to add latest data input

    Hard drive kaput, lost almost everything, trying to piece things together. Most annoying thing. Installed the Excel 2016 pro which I had on my previous hard drive, Microsoft wont accept the key which I still have, even though it was paid for! So I have it for just a month. Might trawl the internet see if I can find a working key, they have some bloody nerve.

+ 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. [SOLVED] Formula to Input the Latest Code from 5 Columns
    By sameer79 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-13-2020, 04:29 PM
  2. [SOLVED] Look up latest data input.
    By reevsey23 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-17-2017, 01:07 PM
  3. [SOLVED] Formula to search for latest input across fields
    By SEMMatt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-21-2015, 08:56 PM
  4. Replies: 9
    Last Post: 11-28-2013, 05:20 PM
  5. Replies: 7
    Last Post: 08-10-2013, 06:44 PM
  6. Replies: 0
    Last Post: 06-03-2011, 08:45 AM
  7. how to get latest input on an seperate worksheet
    By Dean Comer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2006, 07:35 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