+ Reply to Thread
Results 1 to 35 of 35

Equation for averaging cells that include < > signs

  1. #1
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Equation for averaging cells that include < > signs

    This is an excel sheet that I had previously posted in the past and have been instructed to add more rows for sampling in the new year. I've attached an example file of different scenarios that we can experience when testing. For example, if the Depletion is <2 the result will have a < in front of it (example 1). If the Final DO is <1 the result will have a > sign in front of it (Example 2). If both rules are met, no signs are needed. If any of the result(s) do not have signs in front of them, they are automatically averaged in the bold average cell and the results with < > signs discarded. Example 3 is the usual scenarios that we encounter. Examples 1 and 2 are extreme cases. I wanted to also add that the lowest result that we can report is <2.

    I wanted to double check that I have the equations correct in my average cells. I need the most help in the combined average of north and south cells (J21, J44, J67), for example in cell J21, to show an average of J7 and J17.

    Also, is there an equation that we could add to, for example, J7 to show the estimated number that is closest to meeting the rules when all results are < or >? Instead of <49 in J7, the number would actually be <86 because the depletion result was closest to 2. If that isn't possible that's fine. I just wanted to explore all options.
    Attached Files Attached Files
    Last edited by buck08; 12-05-2019 at 01:40 PM.

  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,023

    Re: Equation for averaging cells that include < > signs

    Why are you going to such trouble to make life difficult for yourself? It is (as you may be realising) turning numbers, which you manipulate, into text which just looks like a number - which you cannot easily manipulate.

    Put the sign in a separate column and ALL your calculations become MUCH shorter and simpler...

    J4 copied down to J7:
    =IF(I4="","",IF(G4<2,"<",IF(F4<1,">","")))

    I am unsure of your expected answer if all 3 are > so this may need a tweak.

    K4 copied down to K6:
    =IFERROR(ROUND((I4*300)/(C4),0),"")

    K7:
    =IF(OR(COUNTIF(J8:J10,"=<"),COUNTIF(J8:J10,"=>")=3),INDEX(K8:K10,AGGREGATE(14,6,(ROW(K8:K10)-ROW(K8)+1)/(I8:I10=MAX(I8:I10)),1)),IFERROR(AVERAGEIF(J8:J10,"",K8:K10),""))

    Select J4 to K7, copy and paste all the way down.

    I am unsure of your expected answer if all 3 are > so this may need a tweak.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 12-06-2019 at 05:54 AM.
    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
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    I like how the initial spreadsheet was setup to have the <> directly in front of the number without adding another column. Could you help me with average equations in the cells that have the label combined average beside them with the spreadsheet kept as it is? J:21 would be the average of J7 and J17. I have to set the cells up in a way that meets all of the rule requirements and answers must be rounded to whole numbers. If results have all < or >, the final result would have a < or > in front of it. The north may have 1,2, or all replicates meet the requirements as in example 2 and the south may not and vise versa. I need to average those and have the sign in front of the number which didn't meet the requirements, show up in the combined average cell J:44. In this case the combined average should real >267.

  4. #4
    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,023

    Re: Equation for averaging cells that include < > signs

    Whatever. However, your unusual data layout will cause you endless problems. I dare say it is possible to accommodate your request, but it could take HOURS of work.

    However, I won't be doing that. Others may... but you'd be 110% better off changing your layout.
    Last edited by Glenn Kennedy; 12-10-2019 at 04:49 AM.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I happen to remember this from a couple of years back (August 17)
    I notice that you didn't include J19 in your post although it is highlighted in yellow, so I assume there is an issue there.
    1. Select cell J19
    1. Paste the following into the formula bar:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As for J21 use the following:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As for J7 it appears the Glenn's third formula yields the expected value in K7 and could be combined with the following to do what you want in J7:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Jete, I should have been more clear for J21. It is supposed to be the average of J7 and J17 and if there is a <> sign on one or both of the results it shows up in J21. Also, I had J19 highlight in yellow when the percentage is over 20% to represent a duplicate failure. J21 has been my biggest issue and is the equation I need the most help with.
    The error that I'm seeing with the equation in J7 is, for example, if you put a 1 in cell F5, the result now has two replicates that follow the rules and the results are 374 and 210. With the new equation in J7 it isn't averaging those 2 numbers. It is only bringing the 210 in to the average cell (J7) when the number should be 292. That formula works exactly how I'd want it to when you have all the replicates with either < or > signs on them but is there a way to incorporate that formula in to an equation that would also know to average results that meet the rule requirements?
    Right now, if we have results that all have signs on them, we'll just use a highlighter on the printout to show which estimated value is reportable. The average cell currently calculates all of the <> replicates. I'm fine with continuing to do this, but I just wanted to see if there was an easier way. Thanks for all of the help.

  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,023

    Re: Equation for averaging cells that include < > signs

    Without wanting to labour a point... You said "but I just wanted to see if there was an easier way". There is. See post 2.

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I agree with Glenn, that keeping the formulas that produce the < or > signs (K) and the formulas that produce numerical output (L) separate would make this less confusing.
    We can still display the output that you want by combing the outputs of columns K and L in column J.
    The formulas in columns K:L could be moved and/or hidden for aesthetic purposes.
    Here is an example of what I am talking about.
    Note that in the attached file I have addressed the formula for cell J21.
    I have used Glenn's formula for J7, J11 and J15 (and the corresponding cells down the sheet). I am still unclear as to what you want. I assume that when you said "put a 1 in cell F5" you meant "put a 1 in cell F28".
    Let us know if you have any questions.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Yes I meant F28. What do I have to write in to have the average cells round to the nearest whole number? J30 is 241.333 and I would like the average box to say 241.
    Also, I was messing around with the file provided and when you add numbers for example, I put 6.50 in f4, 2.00 in f5, and 4.00 in f6, it yielded results of <104, 180, 80. In the north average box, the number should be the average of 180 and 80 because they met the rule requirements. Instead, the number in the average box is 180.
    Attached Files Attached Files
    Last edited by buck08; 12-12-2019 at 01:21 PM. Reason: Saw a mistake in the average result

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I believe that pasting the following into cell L7 will resolve both issues:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  11. #11
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    That worked great! My last question (which Glenn hinted at earlier in the thread) is when all signs are > can there be an equation added, to everything else you've done, that brings down the result with the highest final D.O.? I've highlighted the results in yellow that should show up in the average box in these particular scenarios.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    This modification of Glenn's formula seems to work:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Thanks, that worked great. Jete, I found one other scenario that I have attached to get your help with. For the scenario's highlighted in yellow, anything <2 needs to show <2 in the Result cell. The second example is when every reading is <2 so the average cell would have to show <2.

    For the row in red: If we don't fill all cells, is there an equation that can be added to recognize that the result cell only calculates when there is a bottle number or mL's sample added and the average cells only calculate from result cells with numbers in them? I'm only concerned with the 4th row because there will always be at least 3 bottles per run, but sometimes you may need more.
    Last edited by buck08; 12-18-2019 at 08:12 AM.

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I have a feeling that there is supposed to be a file attached to post #13.
    Let us know if you have any questions.

  15. #15
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Yes there was haha
    Attached Files Attached Files

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    Try the following:
    For K3:K6 =IF(OR(B3="",I3=""),"",IF(G3<2,"<",IF(F3<1,">","")))
    For L3:L6 =IF(B3="","",IF(AND(K3="<",ROUND((I3*300)/(C3),0)<2),2,ROUND((I3*300)/(C3),0)))
    Note that the above also apply to K11:L14
    Let us know if you have any questions.

  17. #17
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Can you include a formula in the average calculation that recognizes when the 4th row is blank? It currently brings down the < sign without the number (see attached). Thanks for all of the help with this!
    Attached Files Attached Files

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,765

    Re: Equation for averaging cells that include < > signs

    In J7:

    =IF(L7="","",K7&L7)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  19. #19
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    If I understand correctly, you would like an value in L7 whether or not K7 has a < or > sign. If that is correct, try the following for cell L7:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  20. #20
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    I encountered this issue while going through some results. It's the first set of results like this since I last posted. The formulas have all worked great, but in cell J37, any result <2 must show up in the result cell as <2. In this example, a 1 populated in the result cell and I'd like it to read <2 for these situations. Can you help? Thanks
    Attached Files Attached Files

  21. #21
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    Try the following for cell J37:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  22. #22
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    I found another example today in the average cell J54. I should know how to fix this but I'm drawing a blank. I wanted to know how to make the result show <2 in cell J54 in these situations. No sample can be reported at a value lower than 2. As always, thanks for the help!
    Attached Files Attached Files

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,765

    Re: Equation for averaging cells that include < > signs

    In L54:

    =MAX(2,ROUND(AVERAGE(L45,L52),0))

    Set calculations to automatic, or you'll see no change.

  24. #24
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    I tried the formula and it returns a 2 as the result, but for examples like that I need the cell to say <2. I also attached another example of a cell not bringing down a value to the result box that I was wondering if I could get some help with. I think I messed the sheet up somewhere along the line. Thanks
    Attached Files Attached Files

  25. #25
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I may be missing something, however it seems that the following should work (does in the sample attached to post #22):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  26. #26
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Thanks, that worked. Jete, on the second example on that attachment, what am I doing wrong there? In those situations the results without the >< signs should show up in the average cell. In this case the number 8 should show in the average cell, but instead it says 5. I believe its a formula you had previously worked out for me but I'm missing something.

  27. #27
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    Try pasting the following array entered formula** into cell L65:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Let us know if you have any questions.

  28. #28
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Attached is an example where the result is <2 but the number generated in the L column is 1. What do I have to change in the formula to make these situations populate a 2 in the L column? Thanks
    Attached Files Attached Files

  29. #29
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    From the file: "In the example below, the number generated in cells L52, L60-L62 should be the number 2 and not 1."
    Please explain why the values should be 2 instead of 1.
    Let us know if you have any questions.

  30. #30
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Jete, the lowest allowable number is 2 so anything that shows <2 should produce a 2 in the L column. You can see in J64 that the percent average is 66.7 due to the fact that the calculation is based off of the 2 and 1 results. The percent average should be 0.

  31. #31
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    Changing AND to OR in the formula for cell L52 will produce a value of 2 and similarly changing AND to OR in the formulas for L60:L62 will do likewise:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  32. #32
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    Jete, I may have done a bad job at explaining the problem so let me try again. In cell J64 average percent recovery is 66.7%. In situations where there is a <2 and 2 result in J53 and J63 could we get the calculation to record 0% in J64? When the sheet calculates a result that is <2 and we're averaging that with another cell that produces an actual result, we want to calculate it like that number is a 2. I don't want to change anything you've done with the <> signs, I just wanted to know when calculating a percent recovery (Cell J64) is it possible to recognize a <2 result as a 2. Sorry about the confusion.

  33. #33
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    I am going to offer the following formula suggestion for cell J64:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    However we might need to see scenarios in which the above formula doesn't work (if they exist) in order to get a better understanding of the request.
    Let us know if you have any questions.

  34. #34
    Registered User
    Join Date
    07-18-2017
    Location
    philadelphia, pa
    MS-Off Ver
    2016
    Posts
    37

    Re: Equation for averaging cells that include < > signs

    I've attached a new example for you
    Attached Files Attached Files

  35. #35
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,550

    Re: Equation for averaging cells that include < > signs

    Try changing the formula in L64 to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Also change the formula in J64 to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

+ 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. COUNTIFS to include Cells that include a particular month
    By Ollie Frith in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2019, 04:26 AM
  2. Averaging numbers in cells that also include text
    By cgarmo91 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-11-2018, 05:20 PM
  3. Averaging data not to include null/zero cells.
    By phubbell67 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-10-2014, 04:07 PM
  4. Code which deletes all signs behind a number of signs
    By Mula in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-30-2009, 05:53 AM
  5. How to get rid of $ signs in cells?
    By Andyc7 in forum Excel General
    Replies: 8
    Last Post: 09-02-2007, 12:29 PM
  6. Averaging/Rounding Equation Problem
    By Hansel in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 09-06-2005, 12:05 PM
  7. Averaging/Rounding Equation problem
    By Hansel in forum Excel General
    Replies: 4
    Last Post: 06-28-2005, 04:05 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