+ Reply to Thread
Results 1 to 7 of 7

In need of a flagging formula for 2 scenarios (that are tied together)

  1. #1
    Registered User
    Join Date
    01-14-2020
    Location
    Texas
    MS-Off Ver
    Excel for Office 365
    Posts
    19

    Unhappy In need of a flagging formula for 2 scenarios (that are tied together)

    Hello All,

    I've attempted to work on a formula with multiple variables but I cant seem to get a good way to count without having to include each specific fruit name. I have substituted my data with fruits and colors for simplicity. The goal would be to not be tied to only certain fruits, if 'vegetables' are included, it would continue to function the same way.

    Scenario 1:
    A new row is added to indicate the fruit that one chooses but for each row a counter accumulates for all entries that match. See Sheet 1 data in Column A and B.

    Scenario 2:
    Based on the fruit and the color, if a specific word, or in this case a specific colors do not match, it would be indicated as a FLAG. This would not include blanks. Using Sheet 1 and columns H,I,J, there are 2 apple entries with discrepant colors (One does not match the other), so its flagged. Whereas Kiwi, there are 3 entries, and only one indicates a color, so there is no FLAG.

    I hope this is clear. Thank you all in advance,
    B
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    I'm not sure what kind of result you expect to achieve.

  3. #3
    Registered User
    Join Date
    01-14-2020
    Location
    Texas
    MS-Off Ver
    Excel for Office 365
    Posts
    19

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    The result would be for the word FLAG to display when there is a discrepancy amongst the same fruit having different colors. The goal would be that the list is ever expanding so having the word FLAG at a hypothetical row 200, would update each fruit with the same entry with FLAG.

    Grape - Green
    Grape - Green
    ... (200 rows down)
    Grape - Purple

    This last entry would add FLAG to all prior entries

    Grape - Green FLAG
    Grape - Green FLAG
    ...(200 rows down)
    Grape - Purple FLAG

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

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    One way:

    =IFERROR(IF(ROWS(FILTER($I$2:$I$13,($H$2:$H$13=H2)*($I$2:$I$13<>"")))>1,"Flag",""),"")

    copied down.
    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

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

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    Or use a SPILL array:

    =LET(A,H2:H13,B,I2:I13,MAP(A,LAMBDA(z,IFERROR(IF(ROWS(FILTER(B,(A=z)*(B<>"")))>1,"Flag",""),""))))

    no copy/paste, just delete all expected results first.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-16-2024
    Location
    United States
    MS-Off Ver
    Microsoft Office 2021
    Posts
    4

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    For Scenario 1, where you want to count the occurrences of each fruit regardless of the specific fruit name, you can use a combination of functions like COUNTIF and SUMPRODUCT. This formula will dynamically count the occurrences of each fruit without needing to specify each fruit name individually. Here's a formula you can use:

    =SUMPRODUCT(--(A:A<>"")/COUNTIF(A:A,A:A&""))

    This formula will count the unique occurrences of fruits in column A.

    For Scenario 2, where you want to flag rows where there are discrepancies in colors for each fruit, you can use a combination of IF, COUNTIFS, and IFERROR. Here's a formula you can use:

    =IF(COUNTIFS(A:A,A2,B:B,"<>"&B2)>0,"FLAG","")

    This formula will check for each row if there are other rows with the same fruit (column A) but different color (column B), and if so, it will flag that row as "FLAG".

    You can place these formulas in the respective columns (e.g., in column C for Scenario 1 and in column K for Scenario 2), and they will dynamically calculate the counts and flags based on the data in columns A and B (for Scenario 1) and columns H and I (for Scenario 2). Adjust the ranges as necessary based on your actual data range.

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

    Re: In need of a flagging formula for 2 scenarios (that are tied together)

    Ashlee98. Can I draw your attention to the FIRST yellow banner at the top of the page.

    Take note.

+ 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. Lookup Formula to output all values tied to one value
    By roaml in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-21-2020, 03:39 AM
  2. [SOLVED] Shape coloring macro tied to formula
    By dreddster in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-17-2013, 11:29 AM
  3. Excel Formula tied into Month
    By leviathan86 in forum Excel General
    Replies: 10
    Last Post: 06-08-2012, 01:45 PM
  4. Excel 2007 : Tied Values Lookup Formula
    By loknath in forum Excel General
    Replies: 2
    Last Post: 11-13-2011, 03:05 AM
  5. Replies: 3
    Last Post: 07-16-2011, 11:33 AM
  6. Index-Match formula tied to Cell value
    By Jogier505 in forum Excel General
    Replies: 3
    Last Post: 12-28-2009, 03:49 PM
  7. formula for tracking a variable value tied to specifc svc
    By mkrebs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2005, 07:59 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