+ Reply to Thread
Results 1 to 15 of 15

Need a formula that can search whether a previous cell has specific text, and then...

  1. #1
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Need a formula that can search whether a previous cell has specific text, and then...

    I am trying to create a list of possible perks depending on cards I obtain in a game (working on a spreadsheet for the game both to have it and to learn more of Excel). I have 17 slots on the table and 32 possible perks. It is very unlikely I will ever have 17 perks in-game so that should suffice. The list must draw from previously made cells which determine whether or not I have the card, and if found true, must post the perk on my summary worksheet table.

    In order to work, the formula must do two things. First, it must search whether or not I have the card. Second, it must search whether or not the cells above on the list already contain the perk and only post it in cell if false.

    I have tried many combinations of =IF, =CELL, =ISNUMBER, =SEARCH, and others I can't even remember now. I either end up making formulas too long, or that fail in one area or another (i.e. will only post perk if the perk immediately before it on the list is present).

    Perk Have QState Cancel Unnamed attempt
    Tracey =IF('Space Bazaar'!C5="Y","Kill Tracey First","Nothing") =IF([@Have]="Nothing","N","Y") Tracey =IF('Calc Sheet'!R4="Y",IF(ISNUMBER(SEARCH('Calc Sheet'!S4,Summary!F3)),"Nothing",'Calc Sheet'!Q4))

    This is my Calculation sheet which I have been building in an attempt to solve this problem. Each column is as follows:

    Perk- Label for organization
    Have- States what the text should read on my Summary sheet if I have the card
    QState- A reverse formula determining whether I have the card
    Cancel- Was used as part of my =IF(ISNUMBER(SEARCH( formula attempt, the idea is to cancel the post if said text was found in above cell on Summary sheet
    Unnamed attempt- A possibly useless column used in my attempts using this formula: =IF('Calc Sheet'!R4="Y",IF(ISNUMBER(SEARCH('Calc Sheet'!S4,Summary!F3)),"Nothing",'Calc Sheet'!Q4))

    This is a sample of a 32 row long list of all possible perks. The Summary sheet is simply a blank (though littered with failed attempts) table waiting for the correct formula.

    *Separate but intertwined question: Why is the =IF formula able to read a single cell as text but as range it reads as numerical? (i.e. R3 is text, but R3:R33 is read as numerical, even though all cells contain text).
    Last edited by Diaxus; 12-16-2015 at 11:36 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Please post a sample Excel file with some expected outcomes.

  3. #3
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Quote Originally Posted by JohnTopley View Post
    Please post a sample Excel file with some expected outcomes.
    A sample might be problematic, as my current workbook contains six worksheets containing every card in the game with multiple formula running throughout. The perks are only a small portion of a greater stat ensemble. I'll try to get one up and running. As for the expected outcomes, I'm unsure how to produce such results prior to learning here how to do so? Certainly I'm not trying to be sarcastic or rude, rather inquiring as to specifics of your request, if you would. I am often dense, I'll admit.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    An example of the logic you want to apply: I start to worry if the data is spread over a number of worksheets!

    The reason for the request is quite simple: without realistic data to work with, it is very difficult to propose solutions. Remember we respondents have NO knowledge of what you are trying to do (other than the brief description in your posting). This is often an over-simplification of the real issues so we head off down the wrong path!

    For expected outcome: I don't want formulae just a description of what you expect the result to be. The table in your first post is a "model" but removing the formulae and replacing with a description e.g. describe what you are doing in "Cancel". (imaging writing instructions for a new user to this "game").

  5. #5
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    My workbook has a sheet specifically for calculating the information from the other six worksheets and rendering it useful. I am starting to understand why you say that though.

    Thank you for clarifying. My goal is to make the perks appear on my summary page as I get the cards. I want each perk to show at the top first, and without repeats on the list.

    I have attached a sample containing two source sheets (of the six I mentioned), a "Summary" sheet and a "Calc" sheet just like my main workbook. On the "Calc" sheet you'll find descriptions of the table columns and an explanation of how it is already setup to work. Obviously you can change anything you like. I am thankful you are willing to look into this.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    I confess to being none the wiser having received your file.

    I put "y" in "Source 1" for "Stitch" and it produced a "hard-coded" message and "Qstate" changed to "y": that much I understand. However, for me at least, I need (much) more information on what is expected.

    Is the "Have" to be selected in some way? You mention "cards" but what are they?

    My goal is to make the perks appear on my summary page as I get the cards. I want each perk to show at the top first, and without repeats on the list.
    Perhaps this is why I don't play computer games.

    I am going out shortly but maybe this will be picked up by someone else.

  7. #7
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Thank you for trying. It is all too easy to forget how little someone else knows of something when I am so deeply engrossed in it.

    For any that would take up this challenge, here is the idea. My wife and I have a board game called "Firefly", made after the show by the same name that has a cult following and IMHO was sorely robbed of its chance at greatness. The game involves moving pieces around a board and taking on jobs and such, and there are six planets taken from the show and the movie "Serenity" that was made to tie up loose ends in storyline. Each of these six worlds have a corresponding deck of purchasable crew, ship upgrades, and gear. My workbook is being designed to track which cards I have purchased and create a summarized list of all stats and perks obtained from said cards. Must of these stats have been handled, but this "perks" list has proven formidable.

    The sample workbook contains just enough information to solve the perk problem, but the source pages are copied directly from my main workbook and so contain all the information and formulas I have thus far created. This can all be confusing, so I have placed specific cells on those sheets in bold borders, and these cells are activated by placing "Y" in them, signifying I have obtained the card. Doing so triggers formulas already in place on the "Calc" sheet. These formulas are discribed in the sample workbook on the "Calc" sheet to the right of the active table. The purpose of these formulas are to condense the information on the source sheets into usable data, and also to specify exactly what the "Perk" list should read on the "Summary" sheet when the card is obtained.

    This is the issue. The "Perk" list on the "Summary" page needs to list these perks as I obtain the cards, starting at the top slot (cell), and progressing downwards. There cannot be any copies of perks (i.e. the first, second, and third cells all read "XYZ"). So far, I have managed to make this happen once, but only by stringing the perks such that I would have to get the cards in a specific order for any perks to show up, which is many times unlikely.

    The "Calc" sheet was made to make things easier, but by no means are you required to use the information there, with one exception. The "Have" column contains the exact text to be copied onto the "Summary" sheet, and so either those cells or the text contained within the formulas must be used. I want something that works, and obviously I'm not doing something right, so feel free to change anything except the source pages (these are designed to account for every card, not to crunch all data from them).

    One additional thing: While the sample workbook contains six perks, the actual workbook contains 32, and so any formula must be able to either accommodate all 32 at once, or else through a series of formulae.

    Any and all help would be greatly appreciated.
    Last edited by Diaxus; 12-17-2015 at 06:29 PM.

  8. #8
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Is the "Have" to be selected in some way? You mention "cards" but what are they?
    Yes, the "Have" column contains the exact text to be read on the "Summary" page, and as you have seen, activates when a "Y" is place in the corresponding cell on one of the source pages. Without the "Have" column, there is no text to be placed, so the formula would have to take from this column and copy it onto the "Summary" sheet list, but in such a way that only one copy of the perk is on the list at a time, and that I can obtain the cards in any order and still have the perk show at the top.

    I'm growing concerned that this may be too tall an order for Excel, but if so, it is at least good to know its limitations. If not, I'm actively looking to overcome mine. Thanks again for your help.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    I am also not really sure if I understand what you want, but lets see if this is heading in the right direction...
    C3=IFERROR(INDEX('Source 1'!C:C,MATCH(Table4[@Perk],'Source 1'!B:B,0)),"Nothing")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Quote Originally Posted by FDibbins View Post
    I am also not really sure if I understand what you want, but lets see if this is heading in the right direction...
    C3=IFERROR(INDEX('Source 1'!C:C,MATCH(Table4[@Perk],'Source 1'!B:B,0)),"Nothing")
    It's difficult to fully explain, as part of this is drawn from my own trial and error, and as such can only be demonstrated by giving you every formula I have tried (a list I don't fully have).

    That said, I think you may be on to something here. =INDEX would be far more useful if it would draw from column first and optionally row after, but perhaps that can be solved by using "=TRANSPOSE"? I'll mess around with this for a bit.

    The needed formula must be able also to draw on any active (QState has "Y", or "Have" has text other than "Nothing") cell and copy that to the "Summary" sheet, such that it is not necessary that I have the perk at the top of the list on the "Calc" sheet first, but can obtain any of them in any order. Are there any questions you have? I can try to fill in the the gaps. This is a complex idea.

  11. #11
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    I have another question pertaining to this. I thought I had this solved much earlier, but found that the =IF formula can see a single cell as text (i.e. C3 contains "Stop Here"), but a range it seems to interpret only as numerical (C3:C32). Why is this? It could see the text when I focused it on a cell, but when I input the range it returned "#Value". That completely derailed me.

    Does it have something to do with conjunctive and disjunctive logic? If so, the formula would have to emply "or" logic rather than "and".
    Last edited by Diaxus; 12-17-2015 at 07:36 PM.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    The INDEX/MATCH can take another argument to pick a column...
    =IFERROR(INDEX('Source 1'!C:T,MATCH(Table4[@Perk],'Source 1'!B:B,0),MATCH(Table4[[#Headers],[Have]],'Source 1'!$B$2:$T$2,0)),"Nothing")

    Essentially, this is...
    =INDEX('Source 1'!C:T,MATCH(Table4[@Perk],'Source 1'!B:B,0),MATCH(Table4[[#Headers],[Have]],'Source 1'!$B$2:$T$2,0))
    so this is doing this.....
    =INDEX(range,row-num,column num)
    the 2 MATCH's ID the row number and the column number
    The IFERROR() catches errors (not founds) and returns the text you give it

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Quote Originally Posted by Diaxus View Post
    I have another question pertaining to this. I thought I had this solved much earlier, but found that the =IF formula can see a single cell as text (i.e. C3 contains "Stop Here"), but a range it seems to interpret only as numerical (C3:C32). Why is this? It could see the text when I focused it on a cell, but when I input the range it returned "#Value". That completely derailed me.

    Does it have something to do with conjunctive and disjunctive logic? If so, the formula would have to emply "or" logic rather than "and".
    You normally dont use a range with that kind of IF statement. Can you point me to where you have this?

  14. #14
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    Quote Originally Posted by FDibbins View Post
    The INDEX/MATCH can take another argument to pick a column...
    =IFERROR(INDEX('Source 1'!C:T,MATCH(Table4[@Perk],'Source 1'!B:B,0),MATCH(Table4[[#Headers],[Have]],'Source 1'!$B$2:$T$2,0)),"Nothing")

    Essentially, this is...
    =INDEX('Source 1'!C:T,MATCH(Table4[@Perk],'Source 1'!B:B,0),MATCH(Table4[[#Headers],[Have]],'Source 1'!$B$2:$T$2,0))
    so this is doing this.....
    =INDEX(range,row-num,column num)
    the 2 MATCH's ID the row number and the column number
    The IFERROR() catches errors (not founds) and returns the text you give it
    I see, thank you for clarifying. The sample doesn't have the formula, since it was one of my previous attempts. I was attempting to simplify an =IF string by using a range instead of 31 nested "IF"s. I've since lost the formula from my clipboard with all my copy/paste activity.

  15. #15
    Registered User
    Join Date
    12-12-2015
    Location
    Anchorage, AK
    MS-Off Ver
    2013 Office
    Posts
    12

    Re: Need a formula that can search whether a previous cell has specific text, and then...

    I don't think the sample is accurately showing the issue. I've attached my actual workbook here. It is pretty messy at the moment, but the only sheets that matter are the "Summary", the six source books each of which have colored tabs and odd names such as "Persephone", and the "Calc" sheet. On the Calc sheet are a lot of tables with formulas, and most of these pertain to the stats of the cards and are useless for the current objective. Scrolling to the far right, you will find the table like the one in the sample workbook.

    On the summary sheet, you will find that the perks are in fact showing up there, as I want. However, if you look at the top two cells under "Perks", you will see duplicate text, and this is what I am trying to remove. I achieved this through a long string of =IF arguments, hence my previous question about using ranges in such arguments. Perhaps this may help.
    Attached Files Attached Files

+ 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: 7
    Last Post: 01-04-2014, 10:11 PM
  2. [SOLVED] To search specific text in a cell that contains text string
    By mikail in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 03:02 PM
  3. [SOLVED] loop through certain ranges and put down specific text based on previous cell with data
    By liz5818 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2013, 01:43 PM
  4. [SOLVED] search for text, then search for previous text, replace 1st text including number from 2nd
    By kldailey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2012, 05:23 PM
  5. [SOLVED] Search specific text formula and vlookup
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-19-2012, 03:26 PM
  6. Formula to search cells/columns containing specific text
    By serenalove in forum Excel General
    Replies: 2
    Last Post: 01-25-2010, 01:03 PM
  7. [SOLVED] How do I search for specific text and sum the cell to the right?
    By PacRat2001 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2005, 12:05 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