+ Reply to Thread
Results 1 to 9 of 9

combination of 1, 2 and 5 in the corresponding cell in the full dataset tab

  1. #1
    Registered User
    Join Date
    10-22-2019
    Location
    Loughborough, England
    MS-Off Ver
    1907
    Posts
    4

    Lightbulb combination of 1, 2 and 5 in the corresponding cell in the full dataset tab

    Hi! I want to insert a function into a cell in Excel.

    In my spreadhset, I have two tabs; one with a full dataset, the other one empty. I am looking to fill the empty tab by recoding the data in the full dataset tab using an Excel function in a cell on the empty tab.

    In the full dataset, I have 242 rows. In each cell, the cell contains a combination of numbers from 1-6. For example, 1 or 1,2,3 or 2,4,5 . Here is an example of what the first cell in the first 10 rows look like:

    1,3,4
    1,4
    1
    1,4
    6
    1
    1,4
    1,2,3
    1
    5

    I am interested in the numbers 1, 2 and 5. I am looking to add a function into the cells in the empty tab which tells me about the combination of 1, 2 and 5 in the corresponding cell in the full dataset tab. Here is what I am interested in, specifically, for every cell:

    Functions
    If the cell contains the number 1 anywhere, but not the numbers 2 or 5, return 11
    If the cell contains the number 2 anywhere, but not the numbers 1 or 5, return 12
    If the cell contains the numbers 1 and 2 anywhere, return the number 13
    If the cell contains “5” anywhere, return the number 13
    If the cell contains any other combination or is blank, return the number 20

    I am looking to write these instructions into an Excel Function for the cells in the empty tab. I have had a go, but it is not right. Here is my attempt (note: the word 'CELL' here denotes the Cell number e.g., A5):

    =IF(AND(CELL,*1*, CELL, “<>*2*”, CELL, “<>*5*”), 11, IF(AND(CELL,*2*, CELL, “<>*1*”,CELL, “<>*5*”), 12, IF(AND(CELL, *1*, CELL, *2*), 13, IF(CELL, *5*), 13, 20)

    If you can help me find the correct full function, I would greatly appreciate it. Thanks very much.
    Last edited by McLeod_Research; 10-23-2019 at 03:16 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,635

    Re: HELP: Many IFs and ANDs in formula. Would appreciate help :)

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    I cannot do it for you (forum trouble). Please change your title . Perhaps "combination of 1, 2 and 5 in the corresponding cell in the full dataset tab" will be more descriptive

  3. #3
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: HELP: Many IFs and ANDs in formula. Would appreciate help :)

    Please try

    B2

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards.

    PS:
    Formulation may easier if you have re-order your logic. ^_^



    If the cell contains any other combination or is blank, return the number 20
    Last edited by AliGW; 10-23-2019 at 03:19 AM. Reason: Original post reinstated.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2505
    Posts
    13,757

    Re: HELP: Many IFs and ANDs in formula. Would appreciate help :)

    @ menem

    Administrative Note:

    Welcome to the forum.

    Sorry, but your post does not comply with Rule #6 of our Forum RULES:

    Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction, then send a private message to them asking for clarification.

    All Participants:

    Please do not post a reply in a thread where a Moderator or Administrator has requested an action that has not yet been complied with (e.g. title change, code tags requested, etc.). Thanks.
    Dave

  5. #5
    Registered User
    Join Date
    10-22-2019
    Location
    Loughborough, England
    MS-Off Ver
    1907
    Posts
    4

    Re: HELP: Many IFs and ANDs in formula. Would appreciate help :)

    Thank you for this comment. I have now amended my title.

  6. #6
    Registered User
    Join Date
    10-22-2019
    Location
    Loughborough, England
    MS-Off Ver
    1907
    Posts
    4

    Re: HELP: Many IFs and ANDs in formula. Would appreciate help :)

    Thank you so much - it works Could you explain why this works? Why have you used a COUNTIF and SUM function?

  7. #7
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: combination of 1, 2 and 5 in the corresponding cell in the full dataset tab

    Off topics.

    Thanks to AliGW to recall my prohibited post.
    I was not mean to do that (post a solution against the rules) , I was open the topic and left it open while open Excel to solve the problem,
    then back to browser , post the solution (while not refresh before post). I'll try to refresh browser before post next time.

    Regards.


    Answer to McLeod_Research.

    After I've test on my PC , I found the problem to search by using "*number*" if cell contain only one number (and data type is number , not text).
    And if I use IF(...) I have to if for both of them IF( finding text-number or finding number ... ) the formula length can be imagination.^_^
    But with COUNTIF, I can use a short form of Array [ {"*1*","*2*","*5*",1,2,5} ] , so formula can be shorter.
    (When you use COUNTIF as Array formula , the number will be result;result;... for each of array ( {"*1*","*2*","*5*",1,2,5} )
    and you can see only first of the results , so , SUM can group all result together)

    Solution step is try to branch possible case in a group. Write in IF-Else form may easy to explain (in case of my English).

    Please Login or Register  to view this content.
    Regards.

  8. #8
    Registered User
    Join Date
    10-22-2019
    Location
    Loughborough, England
    MS-Off Ver
    1907
    Posts
    4

    Re: combination of 1, 2 and 5 in the corresponding cell in the full dataset tab

    Thank you so much! This is now solved. I have added to your reputation and I want to thank you and the forum very much for your help and time! Best wishes, Chris

  9. #9
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,272

    Re: combination of 1, 2 and 5 in the corresponding cell in the full dataset tab

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    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.

+ 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. More IFS & ANDS
    By Geekynerd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-19-2018, 12:23 PM
  2. [SOLVED] IFS and ANDS
    By Geekynerd in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2018, 10:57 AM
  3. Help with IF formula - too many ANDs and ORs for my liking!
    By STUARTXL in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-23-2016, 11:54 AM
  4. Help with IF formula - too many ANDs and ORs for my liking!
    By STUARTXL in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-22-2016, 04:49 PM
  5. if and ands
    By sophia_1234 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-09-2014, 03:01 PM
  6. Formula needing help with. (IFs, ANDs, ORs)
    By stacey52891 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-09-2013, 10:37 AM
  7. [SOLVED] Excel Formula - Lots of ORs and ANDs
    By nikolasm in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2013, 04:48 PM

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