+ Reply to Thread
Results 1 to 16 of 16

To return the value of the cell in a row if it match the condition

  1. #1
    Registered User
    Join Date
    04-20-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    To return the value of the cell in a row if it match the condition

    Hi,

    Below is an extraction of my data and I am trying to find a formula that will return me the value of the cell if the last number is 1. So in below example, i should be getting "1|1|4|1" returned since it matches my condition.

    4|3|2|3 3|2|5|4 1|1|4|1 2|4|3|2 5|4|1|5

    Could someone help me out on this?

    Thanks and have a good day!

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: To return the value of the cell in a row if it match the condition

    welcome to the forum
    What are those values in post#1?
    Is each one a cell value?
    The last number I see is 5, so how is your condition met?
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: To return the value of the cell in a row if it match the condition

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    Cheers!
    Deep Dave

  4. #4
    Registered User
    Join Date
    04-20-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: To return the value of the cell in a row if it match the condition

    I'm sorry. The formatting got removed somehow. There is actually a cluster of values in each cell. To illustrate, each line below refer to a cell by itself. Is there a way to have "1|1|4|1" returned since it contains 1 at the right?

    4|3|2|3
    3|2|5|4
    1|1|4|1
    2|4|3|2
    5|4|1|5

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: To return the value of the cell in a row if it match the condition

    Put this in G1 & Drag Across

    =MAX(IF($D$1:$D$5=1,A$1:A$5,""))

    ...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.

    But what if there are multiple rows that end with 1?

  6. #6
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: To return the value of the cell in a row if it match the condition

    Hi Richard,

    Check this:

    =LOOKUP(2,1/(RIGHT($A$2:$A$6)+0=1),$A$2:$A$6)

    Blessing
    Khalid

  7. #7
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: To return the value of the cell in a row if it match the condition

    My contribution:

    With values in columnA starting at A2, paste this into B2 and drag down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Kevin#; 04-20-2016 at 07:32 AM.

  8. #8
    Registered User
    Join Date
    06-06-2014
    Posts
    10

    Re: To return the value of the cell in a row if it match the condition

    My Contribution:

    =INDEX($A$2:$A$6,MATCH(1,MMULT(VALUE(RIGHT($A$2:$A$6,1)),1),0),1)


    Thanks & Regards,
    CMA Vishal Srivastava

  9. #9
    Registered User
    Join Date
    04-20-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: To return the value of the cell in a row if it match the condition

    Thanks for all the contributions. However, i am getting #VALUE!, #REF, etc.

    I have uploaded an extract of my dataset for your assistance.

    The data is in rows and there can only be a "1" at the right end for each row.

    I have highlighted what i wish to be returned in the formula.

    Thanks in advance.
    Attached Files Attached Files

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: To return the value of the cell in a row if it match the condition

    Try in A2

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


    and fill down.
    Dave

  11. #11
    Registered User
    Join Date
    04-20-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: To return the value of the cell in a row if it match the condition

    Thanks Dave. It works initially!

    However, when I drag the formula down, it display the value of the first cell I dragged although the formula is correct.

    I have to hit enter at each row of the formula column for the value to be updated.

  12. #12
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: To return the value of the cell in a row if it match the condition

    Hi Richard,

    Try this {array formula} and copy down and across:

    =IFERROR(INDEX(B$2:B$5,SMALL(IF(RIGHT(B$2:B$5,2)="|1",ROW($B$2:$B$5)-1),ROW(A1))),"")

    Array formula needs to be entered with Ctrl+Shift+Enter (not just enter)

    Blessing

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: To return the value of the cell in a row if it match the condition

    Quote Originally Posted by richard.77 View Post
    Thanks Dave. It works initially!

    However, when I drag the formula down, it display the value of the first cell I dragged although the formula is correct.

    I have to hit enter at each row of the formula column for the value to be updated.
    Is there any chance you have Calculation set to Manual?

  14. #14
    Registered User
    Join Date
    06-06-2014
    Posts
    10

    Re: To return the value of the cell in a row if it match the condition

    Hi Richard,
    Try this non CSE formula and drag it down:

    =LOOKUP(2,1/SEARCH("1",RIGHT(B2:U2)),B2:U2)

    Thanks & Regards,
    CMA Vishal Srivastava

  15. #15
    Registered User
    Join Date
    04-20-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: To return the value of the cell in a row if it match the condition

    Thanks Vishal and Dave. Both worked. Problem solved.

    Thanks all.

    This is a great community!

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: To return the value of the cell in a row if it match the condition

    Glad to hear it. You're welcome and thanks for the feedback.

+ 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 column for condition(s) and return "1" if match
    By help12 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-11-2014, 03:46 PM
  2. [SOLVED] Match string between cells in two tables and return a value based on condition
    By shavar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2014, 04:13 PM
  3. Return a cell value from different sheet if the first condition is met
    By mymachix in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-28-2013, 07:06 AM
  4. [SOLVED] Lookup in columns and return if the condition is match
    By Dumy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-26-2013, 01:47 AM
  5. Replies: 3
    Last Post: 05-08-2013, 02:10 PM
  6. Replies: 3
    Last Post: 12-12-2011, 01:11 PM
  7. Match two condition and return a value
    By magic_ma in forum Excel General
    Replies: 3
    Last Post: 12-09-2011, 09:13 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