+ Reply to Thread
Results 1 to 9 of 9

If Statement with Multiple Named Range Criteria

  1. #1
    Registered User
    Join Date
    04-14-2018
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    11

    If Statement with Multiple Named Range Criteria

    Hi, I'm working on organizing a credit card statement.

    I've made some or bunch of named ranges to categories the statement. I decided to make an additional column that stated weather this line had been added to a named range.

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(NamedRange1,C2))),"Done","Not Done"))

    This works well. To add another Named Range to be check I made an additional IF statement.

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(NamedRange1,C2))),"Done",IF(SUMPRODUCT(--ISNUMBER(SEARCH(NamedRange2,C2))),"Done","Not Done")))

    As you can imagine this is getting ridiculous in size. But, I can't seem to figure out how to add multiple named ranges to be search/checked against C2.

    For Example:
    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(NamedRange1,NamedRange2,C2))),"Done","Not Done"))
    or
    =IF(SUMPRODUCT(--ISNUMBER(SEARCH({NamedRange1,NamedRange2},C2))),"Done","Not Done"))
    Obviously neither of these worked....

    There is probably a much way better solution for this, which I'm would love to hear. Or Any additional thoughts.

    Thank you!

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: If Statement with Multiple Named Range Criteria

    Let's see how the data are organized.

    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.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    04-14-2018
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    11

    Re: If Statement with Multiple Named Range Criteria

    Hi Dflak,

    Made a quick mock of the situation.

    As I mentioned It currently works but the If statement is going to end up ridiculously big. What i'm trying to do is make Expense!C:C an easier statement to encompass multiple Named Ranges without having to make another if statement portion.

    Hope that makes sense.
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: If Statement with Multiple Named Range Criteria

    Would a pivot table solve the issue?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-14-2018
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    11

    Re: If Statement with Multiple Named Range Criteria

    Hi dflak,

    Isn't the pivot table still based off Expense!C:C. That's what I'm trying to consolidate.

    Which is this:

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(Restaurants,A2))),"Done",IF(SUMPRODUCT(--ISNUMBER(SEARCH(Utility,A2))),"Done","Not Done"))

    Trying to make it so each Named Range does not need an additional If statement.

    Some way to include NamedRange1 and NamedRanged2 into the the first If statement.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: If Statement with Multiple Named Range Criteria

    Every time a new kind of expense is added to the expense table, it will be added to the pivot table. Try this yourself, add "Transportation1" to cell A13 and a number. Then right click on the pivot table and select refresh.

    You can use the lists on the criteria list sheet for the purposes of data validation. to make sure you select or enter a correct value in the table on the expense sheet.

  7. #7
    Registered User
    Join Date
    04-14-2018
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    11

    Re: If Statement with Multiple Named Range Criteria

    I think I'm following what you are saying but I'm not 100% sure....

    What I'm running into is Transportation1, Transporation2, Transporation3, will be under it's own Criteria List with it's own DefinedRange which then would have to be added to the Added to "Added to Criteria" formula.

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(Restaurants,A2))),"Done",IF(SUMPRODUCT(--ISNUMBER(SEARCH(Utility,A2))),"Done",IF(SUMPRODUCT(--ISNUMBER(SEARCH(Transportation,A2))),"Not Done")))


    So, what I have is a couple of statements with 1500 items, I was putting together some DefiniedRange to use as a Criteria List. I wanted to add a column to reflect if I've added that criteria to the multiple DefinedRange lists. But, my formula in Added to Criteria is growing by
    IF(SUMPRODUCT(--ISNUMBER(SEARCH(Restaurants,A2))),"Done"
    on every DefinedRange I make. I was hoping for something simplified.

    Maybe I'm missing what you are saying.... I'm not sure.

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: If Statement with Multiple Named Range Criteria

    Try:

    =IF(COUNT(SEARCH(Restaurants,A2),SEARCH(Utility,A2)),"Done","Not Done")

    Enter with Ctrl+Shift+Enter

  9. #9
    Registered User
    Join Date
    04-14-2018
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    11

    Re: If Statement with Multiple Named Range Criteria

    Hi Phuocam,

    Awesome, that worked perfectly! Exactly what I was looking for!

    Thank you!

+ 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. Dependent, Dynamic Named Range with Multiple Criteria
    By JustinCredibLee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-11-2014, 12:46 PM
  2. [SOLVED] Dynamic Named Range to Auto-Populate another range based on criteria
    By BeachRock in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 06:46 PM
  3. Using Named Range in IF-THEN statement
    By morbdetro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2013, 01:41 PM
  4. Using VBA on a named range to replace select statement
    By Tosca1978 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2012, 05:24 AM
  5. Replies: 1
    Last Post: 06-08-2012, 01:28 PM
  6. Sum using named range as criteria
    By adyan76 in forum Excel General
    Replies: 3
    Last Post: 10-06-2011, 02:16 AM
  7. IF statement...If InputBox value equals any value within a certain named range...
    By Cottie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2007, 03:34 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