+ Reply to Thread
Results 1 to 8 of 8

[SOLVED] return specified columns from corresponding row based on specific conditions

  1. #1
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    [SOLVED] return specified columns from corresponding row based on specific conditions

    Hi guys,

    can't get this to work, hoping someone can help me.

    I want to check if columns H, I or J contain the word "Archive" AND column N contains the word "Ed" on the "STEM archiving decisions" sheet, if those conditions are met i want to return the corresponding cells from columns A, B, C, D, E and N to the "Archived" sheet.

    thanks in advance for your help
    Attached Files Attached Files
    Last edited by fabrecass; 02-02-2023 at 08:04 AM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: return specified columns from corresponding row based on specific conditions

    with Power Query

    Course code Course title Media Fellow Subject/School Type OL - Completed
    SK183_2 Nutrition: vitamins and minerals Julia Cooke LHCS Module Ed


    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: return specified columns from corresponding row based on specific conditions

    Thanks for your help, forgive me but i'm not terribly familiar with power query - where am I pasting this code?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: return specified columns from corresponding row based on specific conditions

    Use this formula in cell P2 of the "STEM archiving decisions" sheet and copy it down to the bottom of your data (or beyond, if you might add some more data - the hyphens help to show where the formula is active):

    =IF(AND(N2="Ed",COUNTIF(H2:J2,"Archive")),MAX(P$1:P1)+1,"-")

    It identifies those records which meet the criteria and gives each such record a unique sequential identifier. Then in the Archived sheet you can use this formula in cell H2:

    =IFERROR(MATCH(ROWS($1:1),'STEM archiving decisions'!$P:$P,0),"")

    which identifies the row on the other sheet where the unique sequential numbers occur in column P. You can then use this formula in A2 of the Archived sheet:

    =IF($H2="","",INDEX('STEM archiving decisions'!A:A,$H2))

    Copy this across to F2 and change the reference in F2 to N:N instead of F:F.

    Copy the formulae on row 2 down as far as you need them (until you start to get blanks).

    Hope this helps.

    Pete

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: return specified columns from corresponding row based on specific conditions

    check this one

    and I suggest to read this: Learn Power Query
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: return specified columns from corresponding row based on specific conditions

    Thank you to sandy666 and Pete_UK for your help! Both solutions worked perfectly.

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: [SOLVED] return specified columns from corresponding row based on specific conditions

    my pleasure

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: [SOLVED] return specified columns from corresponding row based on specific conditions

    Glad to help, and thanks for marking the thread as Solved.

    You might also like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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] Return specific cells in a row according to both row and column conditions
    By JustWhip in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-18-2022, 08:38 PM
  2. Return values to specific columns based on range of cell values
    By sbrt10 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-27-2019, 03:15 AM
  3. [SOLVED] How to return sum of specific columns based on a criteria
    By MyStix01 in forum Excel General
    Replies: 2
    Last Post: 11-06-2018, 12:52 AM
  4. Replies: 8
    Last Post: 11-06-2014, 06:19 PM
  5. Replies: 3
    Last Post: 11-24-2011, 09:55 AM
  6. Return specific value if two conditions are met
    By livanoff in forum Excel General
    Replies: 3
    Last Post: 08-23-2011, 03:05 PM
  7. Replies: 2
    Last Post: 07-06-2005, 07:05 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