+ Reply to Thread
Results 1 to 32 of 32

Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given Day

  1. #1
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Unhappy Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given Day

    Hi all,

    This is a hard one for me to explain, so bear with me...

    I'm hoping to generate a report based on the number of times each plot (column F) appears within the range. I知 also hoping to sum the total of each plot (column D) based on the number of times it appears.

    However, I知 faced with a couple of problems:

    1. Some rows contain more than one plot (separated by a comma). In this instance the time spent, and therefore cost, would be divided by the number of plots/values within the same cell to fairly reflect the time/cost spent. This is reflected in columns G and H.


    2. I知 also hoping to return the results based on a few separate conditions:
    1. Based on a yes/no value in column E. Again, I want to see these results returned as separate columns on a new report.
    2. Based on the particular site shown in column C.

    In sheet 2 you will see the results I'm trying to output to give you a better idea.

    I知 currently trying to achieve this for a larger subset of data and would therefore prefer if I could have a report auto-generate for me, if possible.

    Thank you in advance. Let me know if none of the above is clear!

    Luke
    Attached Files Attached Files

  2. #2
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    D3 (&similar for E3):

    =SUMPRODUCT((Table10_2[SITE]=$B3)*(ISNUMBER(SEARCH("ヲ"&$C3&"ヲ",SUBSTITUTE(" "&SUBSTITUTE(Table10_2[PLOT(S)],",","")&" "," ","ヲ"))))*(Table10_2[CHARGABLE]="Yes"))

    F3 (and similar for G3):

    =SUMPRODUCT((Table10_2[SITE]=$B3)*(ISNUMBER(SEARCH("ヲ"&$C3&"ヲ",SUBSTITUTE(" "&SUBSTITUTE(Table10_2[PLOT(S)],",","")&" "," ","ヲ"))))*(Table10_2[CHARGABLE]="Yes")*Table10_2[INVOICE AMOUNT]/Table10_2[NO. OF PLOTS PER DAY])

    The main issue here is that you can not use countifs with a simple wildcard... as there is a risk of double counting... 1 and 123, for example.
    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

  3. #3
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    with file...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Glenn this is awesome, thank you.

    Just a couple of things with this:

    1. Would you be able to adjust the 'number of days' columns to reflect the half and part days where multiple plots exist for the same record as you have with the cost? At the moment I think these are being overcounted.
    2. Would it be possible to auto-generate plots based on their values in sheet 1? I've included these plots manually for illustrative purposes. No worries if not, as I can add these in myself in anticipation for later records being added.

    Many thanks again

  5. #5
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    No. 1. Yes, easy. I just hadn't picked up on that bit.

    No 2. What are the criteria for inclusion in sheet 2. Presence in sheet 1? Date? if so... week/month/what?
    Attached Files Attached Files

  6. #6
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Could you also amend your profile to show Office 365 as your Excel version (that is correct, isn't it..)???

  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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    I'll wait until I get full confirmation that that IS the Excel version you're using...

  8. #8
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    As long as the site name and corresponding plot numbers are auto-generated individually (similar to how I've presented) in sheet 2 then there won't be much else required aside from the totals for cost/time which I've included. Dates I don't think will be necessary as these will be available in sheet 1 if needed.
    Also, if possible, I'd like to count the total number of times the same plot numbers appear within the first sheet, as a reference.

  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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Welcome to the wacky world of Excel. AFAIK, I will have to convert the Table in Sheet 2 to a normal range, as UNIQUE doesn't work in a structured Table. #

    One more issue.

    Can the same plot number occur in more than one site? So far, it hasn't but... I need to know now. It may be that the real PNs are complex and duplication will not happen.... but....

  10. #10
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Oh nuts. Knew it would never be that simple haha.

    Duplicates plot numbers will most certainly occur across multiple sites. This is very common!

  11. #11
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    OK. Still work in progress. However, I have hit a snag and reached out to someone who'll probably be able to fix this before I have time tor make a big espresso.
    Attached Files Attached Files

  12. #12
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Please try at
    B3
    =UNIQUE(CHOOSE({1,2},FILTERXML(SUBSTITUTE(CONCAT(REPT("</m><m>"&Table10_2[SITE],Table10_2[NO. OF PLOTS PER DAY])),"/m","x",1)&"</m></x>","//m"),FILTERXML("<x><m>"&SUBSTITUTE(TEXTJOIN(", ",,Table10_2[PLOT(S)]),", ","</m><m>")&"</m></x>","//m")))

    or with sort

    =SORT(UNIQUE(CHOOSE({1,2},FILTERXML(SUBSTITUTE(CONCAT(REPT("</m><m>"&Table10_2[SITE],Table10_2[NO. OF PLOTS PER DAY])),"/m","x",1)&"</m></x>","//m"),FILTERXML("<x><m>"&SUBSTITUTE(TEXTJOIN(", ",,Table10_2[PLOT(S)]),", ","</m><m>")&"</m></x>","//m"))),{1,2})
    Attached Files Attached Files
    Last edited by Bo_Ry; 03-16-2021 at 05:28 AM.

  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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Well, Bo... I did have time to have that coffee.. Can you eplain how/why you approach worked and my attempts ran into the ground? Where's the difference. What does CONCAT-REPT do, that my concatenation efforts didn't do??

  14. #14
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    This creat list of PLOT separate by comma.
    =FILTERXML("<x><m>"&SUBSTITUTE(TEXTJOIN(", ",,Table10_2[PLOT(S)]),", ","</m><m>")&"</m></x>","//m")


    But SITE has no separate
    this create separator to get the same no of comma from PLOT
    =REPT(","&Table10_2[SITE],Table10_2[NO. OF PLOTS PER DAY])

    This creat list of SITE separate by comma.
    =FILTERXML(SUBSTITUTE(CONCAT(REPT("</m><m>"&Table10_2[SITE],Table10_2[NO. OF PLOTS PER DAY])),"/m","x",1)&"</m></x>","//m")



    Your formula start with
    =Table10_2[SITE]&Table10_2[PLOT(S)]

    This is really hard to separate SITE and PLOT

    To work with your formula , try this

    =FILTERXML("<A><B>"&TEXTJOIN("</B><B>",,SUBSTITUTE(Table10_2[SITE]&"|"&Table10_2[PLOT(S)],", ","</B><B>"&Table10_2[SITE]))&"</B></A>","//B")=UNIQUE(TRIM(MID(SUBSTITUTE(FILTERXML(SUBSTITUTE(CONCAT(SUBSTITUTE(", "&Table10_2[PLOT(S)],",","</m><m>"&Table10_2[SITE]&"|")),"/m","x",1)&"</m></x>","//m"),"|",REPT(" ",20)),{1,21},20)))
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Hi guys,

    Little bit late returning to the party...

    Thank you both so much for your combined efforts here.

    I'm gonna incorporate this into my larger subset of data now and see how it works for me.

    Last thing (I know, I know), would it be possible to include a count of the total number of times each plot number (with corresponding site) appears, and if possible incorporate this into sheet 2?

  16. #16
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Hi Guys,

    Had a chance to test these formulas, but came across a couple of snags:

    1. Totals not adding up to the actual cost (in sheet 3) when using a larger data set (i assume the way the plot numbers are sequenced/formatted in each cell could be a problem?)
    2. When I sort the table It changes the total figure in the second report. This happens when I sort by date in the original data set. When I sort by 'site' the total amount is closer to the actual amount.

    I've created two new sheets (sheet 3 and 4) which shows what I mean when using each formula, including their totals. As mentioned, they all sum to the same amount, but will all change when I filter in sheet 3.

    I'm sure there's an easy explanation for this (I'm probably being a donkey). Let me know if there's an easy fix!
    Attached Files Attached Files

  17. #17
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    1. Bear in mind that FILTERXML has a 32767 character limit...

    2. Not tested, but row 212 was: 301, 302, 303, 304,305 instead of 301, 302, 303, 304, 305.

    3. Try it now.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Glenn this is awesome. I owe you multiple beer when/if I'm ever in Ireland!

    I noticed a couple of duplicate plot numbers in the same cell skewing the results, but everything adds up perfectly now!

    Here's that one last thing (promise)... would you be able to revisit the number of plots (highlighted in orange) in sheet 3. I noticed that I'm counting all plots regardless of the site, so am undercounting the total number of plots and corresponding site (if that makes sense?). I believe this corresponds with the defined name you created for me previously.

  19. #19
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Nothing seems to be highlighted in Orange on sheet 3....

  20. #20
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Oops - my bad.

    Should be there now.
    Attached Files Attached Files

  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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    OK. Been doing outdoor stuff all day.

    On a filtered list there are complications. Filter sheet 3 by Gipping Mill. 12 chargeable, 9 non chargeable, total 18... Argghhh! However, 123, 124 & 127 occurs as both...

    On a non-filtered list, the presence of duplicate plot names will complicate things.

    What do you want to happen????

  22. #22
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    As is, it obviously works for me, but only when filtering to individual site names.

    Plot numbers occurring in both chargeable and non-chargeable for the same site isn't a problem. It's literally just the duplicate plots in the presence of multiple sites that is the issue since it's undercounting the total. This is obviously skewing my averages (to the left of the 'number of plots') as a result.

    Not a major issue if this can't be rectified. Will just have to make do with the number of plots and averages on the individual site level instead of an overall / client level!

  23. #23
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    We're being stupid.... See file. The UNFILTERED totals can be taken directly from sheet 4....
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Can't believe I missed this...

    Everything is there in sheet 4 in order for me to apply averages as is - what a muppet!

    Thanks again. You've truly gone above and beyond. This is awesome!

  25. #25
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    In which case we're both muppets (Statler & Waldorf??). I stared at this for ages before the penny droppped.

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

  26. #26
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    Hi Glenn,

    Sorry to be bugging you with this again. Firstly, my spreadsheet has been working fantastically and have had no issues up to this point. However...

    Since inputting the last batch of data, the FILTERXML formula (in sheet 2) is returning #VALUE error. I noticed when removing last months data that I'm no longer met with this error. The same is true when I remove 80 or so rows regardless of the date or their contents.

    I assume this formula has a limit on how much data it can parse based on this? Is there any way to rectify this?

    Hope you're well by the way!!
    Attached Files Attached Files

  27. #27
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    The attached file has links to external sheets. Please repost with links ONLY to sheet 1. It is POSSIBLE that it's a formula length limitation, but unlikey as Excel can handle 32,767 characters in a formula calculation. I doubt if you'll get there with that formula... but with all the links to an external WS, it's not easy to tell.

    Ignore all of the above!! Back later...
    Last edited by Glenn Kennedy; 04-21-2021 at 01:24 PM.

  28. #28
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    See attached. I'm not overly worried about the columns after column D, just the formula in C4 that I'm struggling with.
    Attached Files Attached Files

  29. #29
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    I'm away for a while. I looked at this earlier. I suspect it's down to character limits being exceeded. You can get about 470 rows with the current set up.

    How about using an extra column with a 2 character code identifying the site name. Using that and a couple of VLOOKUPs would extend the no of rows significantly.

    Views? I can have a go a bit later,if you like... It should sort all column problems. I hope.

  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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    No reply, so I went ahead anyway. see file. It's up and running again. However, you will hit the character limit again unless you archive/delete older material. If this is a continuous sheet (no end date) you will need an alternative approach (VBA).
    Attached Files Attached Files

  31. #31
    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
    44,053

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    I forgot to fix the SUMPRODUCT calculations...
    Attached Files Attached Files

  32. #32
    Registered User
    Join Date
    03-11-2021
    Location
    Colchester, England
    MS-Off Ver
    Office 365
    Posts
    27

    Re: Generate Report Per Plot Based on Number of Times a Specific Value Appears on a Given

    This is great Glenn, thank you.

    Ideally wanted this as a continuous sheet, but is not the end of the world.

    In future, I will have to retire the current workbook and create a new one. Should be easy enough to bring two sheets together at a later stage!

+ 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] Looking for a formula to count the number of times a specific value appears in sequence in
    By Lancasterbe in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 10-27-2020, 06:04 AM
  2. Count number of times a specific text appears for a certain date
    By Alfie092 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2020, 12:25 PM
  3. Count number of times a specific word appears
    By csepesy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-07-2017, 09:48 PM
  4. count the number of times a number appears in a specific range
    By myjebay1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2013, 11:01 AM
  5. Count number a times a specific value appears consecutively.
    By kww0027 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-03-2013, 06:17 PM
  6. Replies: 6
    Last Post: 03-02-2010, 04:15 PM
  7. count the number of times a specific word appears in a column
    By BAR in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2006, 12:10 PM

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