+ Reply to Thread
Results 1 to 7 of 7

check for match of cell to range of cells only if another cell is equal to X

  1. #1
    Registered User
    Join Date
    02-25-2015
    Location
    Chicago, IL, USA
    MS-Off Ver
    2007
    Posts
    24

    check for match of cell to range of cells only if another cell is equal to X

    I知 trying to figure out a formula and am hoping you might be able to help. Attached is a sample worksheet and the explanation of what I知 trying to figure out.

    What I知 trying to do is flag a field if conditions are met ( First check the fiscal year. If the year is X, check list 1, if the year is Y, check list 2: )

    More specific to the worksheet: If cell F2 of sheet 1 is < 2016, look at range a2:a6 of sheet 2 and if there is a match to cell a2 of sheet 1 , result should be "YES", else if no match "NO"; otherwise, If cell F2 of sheet 1 is equal to 2016, look at cells a7:a25 of sheet 2 and if there is a match to cell a2 of sheet 1, result should be "YES", else if no match "NO" ---- The only way I can think of the formula is as follows: =IF(f2<>2016,(COUNTIF('sheet2'!A$2:E$6, A2),"Yes",IF(f2=2016(COUNTIF('sheet2'!A$7:A$25, A2),"Yes","No")). Obviously, this is not working.

    I致e looked online but have had no luck. I知 hoping you can help me out.

    I tried to attach the worksheet but this is my first post so i'm not sure how to.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: check for match of cell to range of cells only if another cell is equal to X

    Click the go advanced button, then choose the paper clip icon from the new tool set that comes up and then manage attachments.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    02-25-2015
    Location
    Chicago, IL, USA
    MS-Off Ver
    2007
    Posts
    24

    Re: check for match of cell to range of cells only if another cell is equal to X

    Yeah. I tried that but a blank screen came up... i thought it might be the browser (Chrome) so i tried IE and still get the blank screen... No buttons, text or anything to let me upload a worksheet.

  4. #4
    Registered User
    Join Date
    02-25-2015
    Location
    Chicago, IL, USA
    MS-Off Ver
    2007
    Posts
    24

    Re: check for match of cell to range of cells only if another cell is equal to X

    Had to upload from my phone. Must be my company's firewall.
    Attached Files Attached Files

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: check for match of cell to range of cells only if another cell is equal to X

    So in the description of what want to do on your attached spreadsheet, you state look at cells A2:A6 on sheet 2. Sheet 2 has sku numbers in the A column that go from row 2 to row 25, so did you mean A2:A25? Then later you state if criteria aren't met you want to now look in A7:A25 for something else. At the bottom of your request you state how you thought the formula should look and you reference A2:E6 in your formula. Your data goes from A2:C25, then at the end of your formula you state A7:A25. I think you should clear up your request to match your actual spreadsheet, I don't want to guess at what you want and go back and forth.

  6. #6
    Registered User
    Join Date
    02-25-2015
    Location
    Chicago, IL, USA
    MS-Off Ver
    2007
    Posts
    24

    Re: check for match of cell to range of cells only if another cell is equal to X

    Sorry about the confusion. The range of skus is in column A of sheet 2 so the E6 reference was my bad.

    To answer your first question, yes, the sku listing is on sheet 2; however, the list can technically be devided into two. 2015 skus (a2:a6) and 2016 skus (A7:A25).

    What I'm trying to do is this:

    If the Year (Sheet 1 - cell f2) is NOT equal to "2016", check to see if the sku (sheet 1 cell a2) has a match to any of the 2015 sku list (sheet 2 cells a2:a6). If there is a match "Yes"
    If the Year (Sheet 1 - cell f2) is equal to "2016", check to see if the sku (sheet 1 cell a2) has a match to any of the 2016 sku list (sheet 2 cells a7:a25). If there is a match "Yes"
    Else, "No"

    =IF(f2<>2016,(COUNTIF('sheet2'!A$2:A$6, A2),"Yes",IF(f2=2016(COUNTIF('sheet2'!A$7:A$25, A2),"Yes","No"))

    I hope this clears things up and sorry if I'm giving you a headache LOL!

  7. #7
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: check for match of cell to range of cells only if another cell is equal to X

    I hope this clears things up and sorry if I'm giving you a headache LOL!
    No worries, you are not giving me a headache. What happens is if one makes assumptions as to what the person who posted wants, when it is not clear, it may become a headache as they go back and forth trying to get it right. I think you cleared it up nicely and I hope you like the solution.

    Good Luck!!!
    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: 2
    Last Post: 12-12-2012, 04:19 AM
  2. Replies: 17
    Last Post: 12-05-2012, 09:01 PM
  3. Check if two cells are equal and copy,paste cell if true
    By solomeros in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2011, 01:22 AM
  4. Check if two cells are equal, copy/paste adiacent cell
    By Macuil0101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2011, 12:40 PM
  5. Replies: 1
    Last Post: 05-25-2006, 04:55 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