+ Reply to Thread
Results 1 to 16 of 16

Provide Outcome based on three conditions.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Provide Outcome based on three conditions.

    Good Morning Team,

    Hope all is well.

    I am hoping this lovely forum could help me build a formula, which summarizes the two different scenarios i am encountering in my attached workbook.

    1) If the "Comp Country (Column B) is different than "name Country" (Column E) then Column H should say move
    "Re-Move Record to Equivalent "

    For example
    Column B = HK
    Column E = UK
    Column H = "Re-Move Record to Equivalent "

    2)
    In total there is 17 records, (6 = UK), (11 = USA). (Given that the UK Scenario is handled in point 1) we only need to compare records where the Comp country (Column b) and Name Country( Column e) are the same.
    Out of those 11 records i need find who the majority Name for a given country/ For example in my scenario "RP" owns 10 out of the 11 records, and "TG" only owns one" therefore the record with "TG" needs to change from "TG" to "RP"
    Attached Files Attached Files
    Last edited by masond3; 02-21-2019 at 09:19 AM.

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Provide Outcome based on three conditions.

    If you want to display "Change account ......." to all lines than use:
    =IFERROR(IF(VLOOKUP($B2,Sheet2!$A$2:$B$3,2,0)<>$E2,"Re-Move Record to Equivalent","Change Account Name from "&$D2&" to "&INDEX($D$2:$D$18,MODE(IF($E$2:$E$18=$E2,MATCH($D$2:$D$18,$D$2:$D$18,0))))),"")
    If you want only first occurrence then use:
    =IF(VLOOKUP($B2,Sheet2!$A$2:$B$3,2,0)<>$E2,"Re-Move Record to Equivalent",
    IF($E2<>$E1,"Change Account Name from "&$D2&" to "&INDEX($D$2:$D$18,MODE(IF($E$2:$E$18=$E2,MATCH($D$2:$D$18,$D$2:$D$18,0)))),""))
    Both are array formulas, so use "Ctrl+Shift+Enter instead of regular Enter for it to take effect.

    Also, if you have multiple countries than use a small database for country name and code.
    Attached Files Attached Files
    Click the * to say thanks.

  3. #3
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    @PaulM100 - Thank you for your swift reply. Let me have a browse through the proposed formula. I will be touch if i have any questions ( no doubt i will )

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,563

    Re: Provide Outcome based on three conditions.

    Did you look at Paul's attachment?
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    @AliGw - When PaulM100 originally posted, there wasn't an attachment. i refreshed and then the attachment was present. ( i think i was premature when adding my original post)

    @PaulM100 - Thank you for the formula that is very useful.
    I have just been amending my data set, aka changing row 9 from RP to DM (similar to TG (row 8) scenario. I guess because your second formula only shows the "first occurrence". is it possible that it could show on all records within that data set that dont match ?

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,563

    Re: Provide Outcome based on three conditions.

    Makes sense!

  7. #7
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Provide Outcome based on three conditions.

    Try this:
    =IF(VLOOKUP($B2,Sheet2!$A$2:$B$3,2,0)<>$E2,"Re-Move Record to Equivalent",
    IF(OR(INDEX($D$2:$D$18,MODE(IF($E$2:$E$18=$E2,MATCH($D$2:$D$18,$D$2:$D$18,0))))<>$D2,$E2<>$E1),"Change Account Name from "&$D2&" to "&INDEX($D$2:$D$18,MODE(IF($E$2:$E$18=$E2,MATCH($D$2:$D$18,$D$2:$D$18,0)))),""))

  8. #8
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    HI PaulM100 - This is exactly what i want thank you. However i think i have noticed some additional scenarios (which i missed . doh ).

    I have attached an updated file.

    But i think i need to include a way that the formula only calculates against a given company aswell. So the formula checks and validates against that particular company, when a new company is found the logic will re-start.

    Scenario 3 ) We will have scenarios (row 19-26) where the all the accounts are aligned, so there no real action. So doesn't need a reason.

    Scenario 4 ) If a new company is on row 27 - 34 , i need to ensure that formula calculates against that given company.

    Bump thread*
    Attached Files Attached Files
    Last edited by masond3; 02-20-2019 at 11:51 AM. Reason: Bumping Thread

  9. #9
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    Sorry to follow up so soon, was just wondering is anyone within the forum community able to help on scenario 3 & 4 listed in the latest excel attachment

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,563

    Re: Provide Outcome based on three conditions.

    Bumping after two days is perfectly acceptable. We recommend once a day.

  11. #11
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Provide Outcome based on three conditions.

    Try this array formula:
    =IF(VLOOKUP($C2,Sheet2!$A$2:$B$3,2,0)<>$F2,"Re-Move Record to Equivalent",
    IF(OR(INDEX($E$2:$E$34,MODE(IF($F$2:$F$34=$F2,IF($B$2:$B$34=$B2,MATCH($E$2:$E$34,$E$2:$E$34,0)))))<>$E2,$F2<>$F1),"Change Account Name from "&$E2&" to "&INDEX($E$2:$E$34,MODE(IF($F$2:$F$34=$F2,IF($B$2:$B$34=$B2,MATCH($E$2:$E$34,$E$2:$E$34,0))))),
    IF(COUNTIFS($B$2:$B$34,$B2,$C$2:$C$34,$C2,$E$2:$E$34,$E2,$F$2:$F$34,$F2)=COUNTIF($B$2:$B$34,$B2),"No action all Alligned","")))

  12. #12
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    HI Paul,
    Thanks for taking the time to have a look. I have attached a screen shot. it looks like since we have amended the formula It doesn't calculate the other scenarios.

    Column I (Original Formula)

    =IF(VLOOKUP($C2,Sheet2!$A$2:$B$3,2,0)<>$F2,"Re-Move Record to Equivalent",
    IF(OR(INDEX($E$2:$E$18,MODE(IF($F$2:$F$18=$F2,MATCH($E$2:$E$18,$E$2:$E$18,0))))<>$E2,$F2<>$F1),"Change Account Name from "&$E2&" to "&INDEX($E$2:$E$18,MODE(IF($F$2:$F$18=$F2,MATCH($E$2:$E$18,$E$2:$E$18,0)))),""))

    Column J (Latest Formula)

    =IF(VLOOKUP($C2,Sheet2!$A$2:$B$3,2,0)<>$F2,"Re-Move Record to Equivalent",
    IF(OR(INDEX($E$2:$E$34,MODE(IF($F$2:$F$34=$F2,IF($B$2:$B$34=$B2,MATCH($E$2:$E$34,$E$2:$E$34,0)))))<>$E2,$F2<>$F1),"Change Account Name from "&$E2&" to "&INDEX($E$2:$E$34,MODE(IF($F$2:$F$34=$F2,IF($B$2:$B$34=$B2,MATCH($E$2:$E$34,$E$2:$E$34,0))))),
    IF(COUNTIFS($B$2:$B$34,$B2,$C$2:$C$34,$C2,$E$2:$E$34,$E2,$F$2:$F$34,$F2)=COUNTIF($B$2:$B$34,$B2),"No action all Alligned","")))
    Attached Images Attached Images

  13. #13
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Provide Outcome based on three conditions.

    Have you entered it as an array formula with Ctrl+Shift+Enter instead of regular Enter? As you can see in the attachment it works just fine.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    @PaulM100 - Well i thought i did lol. Let me try again..

  15. #15
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London, England
    MS-Off Ver
    EXCEL 2013
    Posts
    324

    Re: Provide Outcome based on three conditions.

    @PaulM100 - I am an idiot - thank you very much for taking the time to have a look at this problem i was encountering. Many plans for the 14c weather ?

    @ AliGW - Thank you for your help.

    For my own sake, does providing scenarios with the logic, help you determine the best solution to tackle the problem ?

  16. #16
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Provide Outcome based on three conditions.

    You're welcome. And yes, explaining the logic behind it helps a lot. as well as uploading a sample whenever is needed.

+ 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. Move a row based on a drop down outcome please help
    By Nickobrien22 in forum Excel General
    Replies: 2
    Last Post: 02-08-2017, 12:11 PM
  2. Replies: 5
    Last Post: 08-21-2015, 11:22 PM
  3. Looking for a formula to provide an outcome from a listing of information
    By s.tara91 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-25-2013, 02:27 AM
  4. Provide text and or color from conditions
    By ufomongo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2012, 12:19 PM
  5. If then else based on outcome of cells.find
    By Jeroen1000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-09-2010, 05:20 AM
  6. Replies: 4
    Last Post: 12-08-2009, 10:19 AM
  7. Excel Outcome Subject to Two Conditions?
    By demon8991 in forum Excel General
    Replies: 3
    Last Post: 09-30-2009, 06:28 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