+ Reply to Thread
Results 1 to 7 of 7

Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

  1. #1
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    Sample Excel workbook is attached (version 1997-2000)

    I have Table of Students in Range A1:L209 (this could extend to 250 or 300 or so, but currently 209 only)

    Column A has Student name

    Column B to J has some other values retrieved through formulas from other worksheet within same workbook. (perhaps not relevant for this query)

    Column K has header 'Passed' for which value 1 is assigned through formula against respective student who have passed
    Column L has header 'Failed' for which value 1 is assigned through formula against respective student who have failed

    I want a small tabulation for both categories of students (all those) who have passed and failed separately


    All Those who have passed - Starting from Cell O28
    All Those who have failed - Starting from Cell O47


    Column P to S i will populate once i get the name using Index/Match Concept.


    I have filled the O28 and O47 table just to show how it should look like for understanding purpose.
    Attached Files Attached Files
    Last edited by analystbank; 07-13-2018 at 02:09 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    In O28:

    =IFERROR(INDEX(A:A,SMALL(IF($K$2:$K$209=1,ROW($A$2:$A$209)),ROWS($A$1:A1))),"")

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Once confirmed, drag copy down.

    In O47:

    =IFERROR(INDEX(A:A,SMALL(IF($L$2:$L$209=1,ROW($A$2:$A$209)),ROWS($A$1:A1))),"")

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Once confirmed, drag copy down.

    As your data grows, you will need to extend the ranges, so consider making your data range into a table and using field values instead (see attached), because then your data can grow without affecting your formulae. You would then need formulae like this:

    =IFERROR(INDEX(StudentSuccess[Student],SMALL(IF(StudentSuccess[Passed]=1,ROW(StudentSuccess[Student])),ROWS($A$1:A1))-1),"")

    =IFERROR(INDEX(StudentSuccess[Student],SMALL(IF(StudentSuccess[Failed]=1,ROW(StudentSuccess[Student])),ROWS($A$1:A1))-1),"")
    Attached Files Attached Files
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    Hi,
    Cell 'O28' formula then dragg down.
    Please Login or Register  to view this content.
    OR older version of Excel
    Please Login or Register  to view this content.
    Cell 'O47' formula and dragg down
    Please Login or Register  to view this content.
    OR older version of Excel
    Please Login or Register  to view this content.
    Regards.
    Last edited by maras_mak; 07-13-2018 at 03:08 AM.

  4. #4
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    @Thanks a ton, AliGW Esq. (Madam), for offering solution and flexibility for future purpose.

    I will try to understand what each subset of formula does the work and brings out the desired result.

    @maras_mark, your is also splendid to see that max row number could be defined which can accommodate changing data (population) requirement .


    @Maras_mark, Sir if you can explain what your subset of formula does, will be helpful, or i will google and see respective excel function to decipher what it mean and how it brings result.

    Thanks all
    Last edited by analystbank; 07-13-2018 at 03:16 AM.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    Esquire is a word used with men, never women, but thanks for the comments - glad to have helped.

  6. #6
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    Quote Originally Posted by AliGW View Post
    Esquire is a word used with men, never women, but thanks for the comments - glad to have helped.
    apology for that, this is what happens when less is known. Thanks for correcting.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Get Cell value from adjacent cell if it has specific number or Text - 1 in given case

    Just a titbit of information!

    Thanks for the rep.

+ 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. [SOLVED] Search many workbooks for specific text, then insert a text in adjacent cell
    By MDW12 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-26-2017, 02:08 PM
  2. Find specific value in Row, Return Text from Adjacent Cell
    By oneforfive in forum Excel General
    Replies: 5
    Last Post: 07-21-2015, 03:57 PM
  3. If cell contains specific text then count adjacent cell
    By KELLIS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-05-2014, 04:45 PM
  4. [SOLVED] Text in a cell, then formula to put a particular number in adjacent cell
    By jojo101 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2014, 09:09 AM
  5. Replies: 1
    Last Post: 04-11-2013, 01:49 PM
  6. Input cell value from one sheet to another if adjacent cell is specific text
    By TheRoni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2012, 12:49 AM
  7. [SOLVED] Counting a specific number only if an adjacent cell has something
    By Hugsie Bear in forum Excel General
    Replies: 5
    Last Post: 08-02-2006, 09:47 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