+ Reply to Thread
Results 1 to 22 of 22

Macro or Formula for Unique Value based on multiple criteria

  1. #1
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Macro or Formula for Unique Value based on multiple criteria

    Dear Experts,

    Please find here attached workbook, where i am looking for the macro or formula for unique account description under Income and Expenses heading from data worksheet based on the selected date (Cell C2 in Details worksheet). Worksheet and workbook will be protected after the completion of the assignment.

    I hope i have explained everything from my end. If you do require further clarification, Please do let me know.

    Many thanks for your kind help.

    Regards,

    Neilesh
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    One way, using variants of this array formula:

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$7:B7,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    One way, using variants of this array formula:

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$7:B7,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Thank you so much Dear Expert. Thanks a lot once again for your precious help.

    Many thanks.

    Regards,


    Neilesh

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    You're welcome!!

  5. #5
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Macro or Formula for Unique Value based on multiple criteria

    Glen your formula for 28.02.2017 in Expenses, don't work

    For Expenses you have to change your formula:

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$7:B7,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")

    to

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$26:B26,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    Thnks for the correction!! You're right.

  7. #7
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Indi_Ra View Post
    Glen your formula for 28.02.2017 in Expenses, don't work

    For Expenses you have to change your formula:

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$7:B7,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")

    to

    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(0,INDEX(IF(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=Details!$B$5,IF(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=Details!$C$2,COUNTIF(Details!$B$26:B26,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))),0),0)),"")
    Thank you so much dear Expert. Many thanks and regards to your valuable support and precious feedback.

    Regards,

    Neilesh

  8. #8
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Macro or Formula for Unique Value based on multiple criteria

    As an alternative:
    Array formula
    For Income:
    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(1,(1+COUNTIF(Details!$B$7:B7,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))*(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=$B$5)*(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=$C$2),0),1),"")

    For Expenses:
    =IFERROR(INDEX(Table_Acct_VW_BudgetVsActualDateWise_1[Account],MATCH(1,(1+COUNTIF(Details!$B$26:B26,Table_Acct_VW_BudgetVsActualDateWise_1[Account]))*(Table_Acct_VW_BudgetVsActualDateWise_1[GroupTypeName]=$B$24)*(Table_Acct_VW_BudgetVsActualDateWise_1[Apldate]=$C$2),0),1),"")
    Last edited by Indi_Ra; 05-08-2017 at 01:22 PM.

  9. #9
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Dear Experts,

    Thank you so much for your precious support and valuable contribution. Due to modified requirement now i have two dates (Current Year and Previous Year) for the same solution provided based on one criteria as current year date requirement. Request to you kindly do provide the solution for the same.

    Please find here attached workbook for your valuable support and precious contribution. Thank you so much once again for your precious help.

    Regards,

    Neilesh
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    Confused. You have one date column in your raw data and 2 date criteria???? Which date is to be matched where? More explanation, please.

  11. #11
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Confused. You have one date column in your raw data and 2 date criteria???? Which date is to be matched where? More explanation, please.
    Dear Expert,

    I have to match with both the dates as Current Year and for the same date as previous year Sir. Suppose if the one data for the current year is matching with both the dates then only one unique item will be appeared but if it is matching with one and not the another date then only one unique item will be appeared under Income and Expenses.

    I hope i have explained Sir. Please do let me know if you do require some more details on the same.

    Thank you once again for your precious support Sir.

    Regards,

    Neilesh

  12. #12
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Macro or Formula for Unique Value based on multiple criteria

    I don't understand.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    Thank you Indi Ra!! I have read this 3 or 4 times and still don't have a clue about what is wanted!!! I feel better, knowing that you don't get it either!!

  14. #14
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Thank you Indi Ra!! I have read this 3 or 4 times and still don't have a clue about what is wanted!!! I feel better, knowing that you don't get it either!!
    Dear Experts,

    In the Details tab there are two dates, one is for the current year and another is for the previous year same date and i am looking for the unique account description based on these two dates as well Income and Expense criteria.

    If the current year based unique account description is available then that will be appeared based on the current year date, in Details tab and if the previous year account description is available based on the previous year date then that will be appeared but if there is common account description is available for both the dates then a common account description will be appeared for Income and Expenses.

    I hope now it is cleared Dear Experts. Please do let me know for further clarification.

    Many thanks and kind regards,

    Neilesh

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    You explanation does not help. sorry!!!

    This sentence was too long!! "If the current year based unique account description is available then that will be appeared based on the current year date, in Details tab and if the previous year account description is available based on the previous year date then that will be appeared but if there is common account description is available for both the dates then a common account description will be appeared for Income and Expenses."


    Open the attached sheet. for 18/1/17 and 18/1/16 coloured yellow (inc) and Gold (exp), what result do you expect to see???
    Attached Files Attached Files

  16. #16
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    You explanation does not help. sorry!!!

    This sentence was too long!! "If the current year based unique account description is available then that will be appeared based on the current year date, in Details tab and if the previous year account description is available based on the previous year date then that will be appeared but if there is common account description is available for both the dates then a common account description will be appeared for Income and Expenses."


    Open the attached sheet. for 18/1/17 and 18/1/16 coloured yellow (inc) and Gold (exp), what result do you expect to see???
    Dear Expert,

    Thank you so much for your precious efforts. But what if the current year date is not available in the raw data and only the previous year data is available then the unique account description will appear as blank. That is what i am looking for Sir and if the unique account description is available for both the year dates then a single account description will be appeared which will be common for both the dates.

    I hope i have cleared now Sir.

    Many thanks and kind regards,

    Neilesh

  17. #17
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Dear Expert,

    I am looking unique account description based on either previous year date or the current year date given in the details tab or common for the both the dates. Request to you please help me out Sir.

    Regards,

    Neilesh

  18. #18
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    You explanation does not help. sorry!!!

    This sentence was too long!! "If the current year based unique account description is available then that will be appeared based on the current year date, in Details tab and if the previous year account description is available based on the previous year date then that will be appeared but if there is common account description is available for both the dates then a common account description will be appeared for Income and Expenses."


    Open the attached sheet. for 18/1/17 and 18/1/16 coloured yellow (inc) and Gold (exp), what result do you expect to see???
    Dear Experts,

    Please find here attached revised workbook, i have highlighted where few dates are common but few are unique for the current year as well as for the previous year and based on the same i am looking for the formula that if the in the current year account description is not available and if the same is available for the previous year then that will appear dear Experts.

    Thank you for your precious support and valuable cooperation dear Experts.

    Regards,

    Neilesh
    Attached Files Attached Files
    Last edited by Neilesh Kumar; 05-08-2017 at 12:54 PM. Reason: forget to attach attachment

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    I still don't know what your expected answers look like. So, this is a guess. Both are array formulae and can only be followed by looking at the attached sheet.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 05-08-2017 at 01:33 PM. Reason: Awful spelling

  20. #20
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    Istill don't know what your expected answers look like. So, this is a guess. Both are arry formulae and can only be followed by looking at the attached sheet.
    Dear Sir,

    Thank you very much Sir. Exactly the same i was looking for Sir. Thanks you so much once again Sir.

    Many Thanks and Kind Regards,

    Neilesh

  21. #21
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Macro or Formula for Unique Value based on multiple criteria

    That was lucky!! You're welcome. "See" you again sometime. A word of advice. If you can, always include some manually calculated expected results.

  22. #22
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    842

    Re: Macro or Formula for Unique Value based on multiple criteria

    Quote Originally Posted by Glenn Kennedy View Post
    That was lucky!! You're welcome. "See" you again sometime. A word of advice. If you can, always include some manually calculated expected results.
    Sure Sir I will. Thank you so much Sir once again for your precious and valuable support.

    Regards,

    Neilesh

+ 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. Extract Unique List Based on multiple criteria
    By Herbiec09 in forum Excel General
    Replies: 7
    Last Post: 01-14-2017, 07:23 AM
  2. Getting unique values based on Multiple Criteria
    By gclode in forum Excel General
    Replies: 3
    Last Post: 06-20-2016, 02:19 PM
  3. Replies: 6
    Last Post: 04-20-2015, 07:22 AM
  4. [SOLVED] Unique value count based on multiple criteria
    By Ronny66 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2013, 10:18 AM
  5. Unique Copy and Paste Macro - Multiple Worksheets Based on IF (AND) criteria
    By dwalt75 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-16-2013, 04:49 PM
  6. Formula to count Unique text based on multiple criteria
    By OAMPS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-14-2012, 10:48 AM
  7. Multiple selection criteria, which formula? .. and selection based on unique numbers
    By FalkirkJim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2012, 05:22 PM

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