+ Reply to Thread
Results 1 to 18 of 18

If number only appears once, bring back what it says in this column

  1. #1
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    If number only appears once, bring back what it says in this column

    Hi,

    I am starting to pull my hairs out with this! I have all the data on the 'Summary' sheet. On sheet 1 in column B ("From"), I need it to match the number to the number on the 'Summary' sheet, and if it says "Originates" in column C, to bring back column A. I managed to do an IF statement but it brings back errors randomly and I could really do with this in VBA.

    Once the above is done, I need a similar thing for column C on 'Sheet 1' except this time it's if column C on the 'Summary' sheet says "Terminates". But there's also a caveat here... if the number only occurs once in the data, and if it says "Originates" to bring back the name.

    Hopefully this makes sense...
    Attached Files Attached Files
    Last edited by Loupiee; 05-08-2020 at 02:17 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    B2 =IF(INDEX(Summary!$A$1:$C$462,Match($A2,Summary!$B$1:$B$462,0),3)="ORIGINATES",INDEX(Summary!$A$1:$C$462,match($A2,Summary!$B$1:$B$462,0),1),"")

    For the result in C2 you have to spell it out for me.

    When do you want to get which answer and why?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    That's brilliant, thank you!

    For C2, it needs to do like B2 but bring back ones that say "TERMINATES" on the 'Summary' sheet but there's an and - it also needs to look for non-duplicates in column B2 on the 'Summary' sheet (about a third are duplicates) and if column C (Summary sheet) = ORIGINATES, bring back the value in column A to 'Sheet 1' column C.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    Please poste and show a couple of answers in your Excel file.

  5. #5
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Attachment 676530

    In column A, I have put a conditional formatting in place to highlight the duplicate numbers. For all the ones that aren't duplicates and say "ORIGINATES" (in column C of the Summary sheet), the file number goes in column C (on sheet 1).

    The cells I've coloured orange, I used your formula above but changed "ORIGINATES" to "TERMINATES".

    Thank you for helping me with this

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    "Invalid Attachment specified. If you followed a valid link, please notify the administrator."

  7. #7
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Does this one work?
    Attached Images Attached Images

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    That is not a excel file I could work in.

    So it is not helpfull for me.

  9. #9
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Sorry, excel file attached
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    explain again,

    In sheet summary:

    you want to find the first duplicated value in column B?

    After that you would like to find the next value (in column C)?

    And when comes "TERMINATES" is relevant in the formule.

    I do not understand what the criteria are and in which order.

  11. #11
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Think it'll help if I explain what this data is a bit. The numbers reference a line that is going from one drawing to another. It's a bit like a map - say the number starts at point A on drawing 1, and carries on on drawing 2 at point B and then terminates on drawing 3 at point C. In the data it'll show like:

    Column A | Column B | Column C
    00565 | 1020-18-001 | ORIGINATES
    00565 | 1020-18-002 | CONTINUES
    00565 | 1020-18-003 | TERMINATES

    There are some numbers (in column A) that only appear once, saying ORIGINATES in column C. They have no carry on in any other drawings and so will not duplicate in the data. This is one of the things that column C on sheet 1 needs to bring back.

    If a number has TERMINATES in column C, it essentially means that it is a duplicate - there will be in the data that number elsewhere saying ORIGINATES.

    So, column C on sheet 1 needs to bring back both. It's not an IF not this bring back this. It's an AND in some way. But it needs to work through the list one by one as I have the data dump which then get splits out into about 10 sheets (this is just one of them) using the Advanced Filter.
    Last edited by Loupiee; 05-07-2020 at 03:37 PM.

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    Ok that's usefull information, but in the example, what is the expected result for column C
    1020-18-001 ORIGINATES ?

    or

    1020-18-002 CONTINUES ?

    or

    1020-18-003 TERMINATES ?

  13. #13
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    In the example it would be:
    1020-18-003 TERMINATES that comes back. The number (column A) makes it that it's not a unique number/is a duplicate.

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    But then I think I don't understand.

    When it is TERMINATES it is always a duplicated one, so we only have to look at Terminates?

    So the order is look if there is Terminates, then the result is 1020-18-003.

    If it is not Terminates, it has to be 1020-18-001.

    Is this statement correct?

  15. #15
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Sometimes it says CONTINUES, or CUSTOM and when that happens the 'number' will be a duplicate and those are not to be brought back.

  16. #16
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    Summary D2=IF(And(C2<>"Terminates",countif($B$2:$B$46,$B2)>1),"yes","") and drag down.

    Sheet 1 D2 =if(INDEX(Summary!$A$1:$C$462,Match($A2,Summary!$B$1:$B$462,0),3)="TERMINATES",INDEX(Summary!$A$1:$C$462,match($A2;Summary!$B$1:$B$462,0),1),if(VLookup(A2,Summary!$B$2:$D$461,3,0)="yes","",if(INDEX(Summary!$A$1:$C$462,Match($A2;Summary!$B$1:$B$462,0),3)="ORIGINATES",INDEX(Summary!$A$1:$C$462,match($A2,Summary!$B$1:$B$462,0),1),""))) and drag down (green cells).

    See the attached file.
    Last edited by oeldere; 05-08-2020 at 03:13 AM. Reason: ; instead of , in formula

  17. #17
    Registered User
    Join Date
    03-20-2020
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    10

    Re: If number only appears once, bring back what it says in this column

    Thank you very very much! Worked like a dream

  18. #18
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: If number only appears once, bring back what it says in this column

    It was more difficult to understand the question than, in this case, produce the answer.

    Glad I could help.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

+ 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. Replies: 1
    Last Post: 02-29-2020, 07:44 AM
  2. [SOLVED] Bring back certain number of characters before a particular letter or number
    By loveridge01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-01-2015, 05:49 AM
  3. [SOLVED] How to Bring back the Value of the top of the column
    By Diego Santos in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-20-2015, 10:33 AM
  4. [SOLVED] right find to bring back only a number
    By namluke in forum Excel General
    Replies: 5
    Last Post: 01-20-2015, 09:14 AM
  5. Array Formula Lookup - Bring back Lowest Date + Bring Back Cell Location
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2014, 12:08 PM
  6. Replies: 8
    Last Post: 04-27-2014, 05:42 PM
  7. [SOLVED] Formula to bring back a number if X is Y or Z
    By jonathan.haynes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2013, 08:03 AM

Tags for this Thread

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