+ Reply to Thread
Results 1 to 20 of 20

Return the value of cell based from 2 criterias

  1. #1
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Return the value of cell based from 2 criterias

    Hello,

    I hope everyone is doing well

    I have a sample excel file attached. In sheet named "salary" cell A2 contains an old salary and B2 contains the new salary. What it needs to find is the exact values of A2 and B2 in the other sheet named "Admin scale" and returns the row heading (1 to 11) for level and 1 to 25 for the grade, the value that should return is the highest value which is the new salary.

    I hope anyone can assist me. Thank you in advance.

    Corine
    Attached Files Attached Files
    Corine

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Return the value of cell based from 2 criterias

    Hi
    please try in C2
    =IF($B2>$A2,INDEX('Admin Scale'!$A$1:$A$12,AGGREGATE(14,6,(ROW('Admin Scale'!$A$1:$Z$12)/($B2='Admin Scale'!$A$1:$Z$12)),1)),INDEX('Admin Scale'!$A$1:$A$12,AGGREGATE(14,6,(ROW('Admin Scale'!$A$1:$Z$12)/($A2='Admin Scale'!$A$1:$Z$12)),1)))

    D2:
    =IF($B2>$A2,INDEX('Admin Scale'!$A$1:$Z$1,AGGREGATE(14,6,(COLUMN('Admin Scale'!$A$1:$Z$12)/($B2='Admin Scale'!$A$1:$Z$12)),1)),INDEX('Admin Scale'!$A$1:$Z$1,AGGREGATE(14,6,(COLUMN('Admin Scale'!$A$1:$Z$12)/($A2='Admin Scale'!$A$1:$Z$12)),1)))
    Attached Files Attached Files

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Return the value of cell based from 2 criterias

    Remove the #Value and other non numbers from your list and the following code will provide you with a viable solution. If you leave those non-numericals in the columns, the code will fail.

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Return the value of cell based from 2 criterias

    On Admin Page

    Formula for A13 =MOD(ROW()-2,11)+1
    Formula for B13 =OFFSET($A$1,MOD(ROW()-2,11)+1,INT((ROW()-13)/11)+2)
    Formula for C13 =INT((ROW()-13)/11)+2

    Fill down to row 276 then copy paste Values

    Delete Columns D to Z

    Formula for C2 to C12 =INT((ROW()-13)/11)+2

    Copy Paste Values

    This Gives you a nice clean table.

    on the Salary Sheet

    Formula For C2
    =MOD(MAX(IF('Admin Scale'!$B$1:$B$276=$B2,ROW($B$1:$B$276),0))-1,11)

    Formula for D2
    =INT(MAX(IF('Admin Scale'!$B$1:$B$276=$B2,ROW($B$1:$B$276),0)-1)/11)+1
    Attached Files Attached Files
    Last edited by mehmetcik; 11-25-2020 at 02:13 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Return the value of cell based from 2 criterias

    Please try at

    C2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12+'Admin Scale'!$C$2:$Z$12=A2+B2)*'Admin Scale'!$A$2:$A$12,))

    D2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12+'Admin Scale'!$C$2:$Z$12=A2+B2)*'Admin Scale'!$C$1:$Z$1,))
    Attached Files Attached Files

  6. #6
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Hi Belinda,

    Thank you for you quick reply and effort. The formula seems to be working fine in most of the values however , in range A226:B263, the correct result should be Grade 5 Level 10 as per the Admin Scale table. Your formula which gives the result of Level 5, Grade 22 is incorrect as it would return the value 12270.

  7. #7
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Hello Bo_Ry

    Thank you for your reply and effort formula seems to be working fine however in cell A442:B445, the level should be level 2 (not 4) grade 25 as per the admin scale.

  8. #8
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by corinereyes View Post
    Hi Belinda,

    ............. in range A226:B263, the correct result should be Grade 5 Level 10 as per the Admin Scale table. .

    Hi - so when there is more than one match in your table - what values would you like to be returned?
    The same problem in lines 55-56 isnt it? should be 4 and 9....

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Return the value of cell based from 2 criterias

    My formula gives 2 and 24 on row 4422-24.png

  10. #10
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by belinda200 View Post
    Hi - so when there is more than one match in your table - what values would you like to be returned?
    The same problem in lines 55-56 isnt it? should be 4 and 9....
    Hello,

    55 and 56 is correct no problem with that. A442:B442, A443:B442 and so on, the correct result should Level 5 Grade 10 (please see the admin scale sheet- cells J6:K6 (J6=7460 & K6=7830) it should match both of the old and new salary from sheet "salary" A226 & B226.

  11. #11
    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,054

    Re: Return the value of cell based from 2 criterias

    corinereyes. Please update your profile to show the Excel version you are using. Clearly it is Excel 2010 or later, but your profile shows 2003 & 2007.
    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

  12. #12
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Hello Boy_Roy,

    Yes that is correct. Sorry i was referencing a wrong file. However please see the pic to show the issues. Formula Seems to be working almost good.
    Attached Images Attached Images

  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,054

    Re: Return the value of cell based from 2 criterias

    Please see Post 11.

  14. #14
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by Glenn Kennedy View Post
    corinereyes. Please update your profile to show the Excel version you are using. Clearly it is Excel 2010 or later, but your profile shows 2003 & 2007.
    thank you .done updating sorry for that

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Return the value of cell based from 2 criterias

    Any thoughts on my solution in Post #3. Have you even tried it?

  16. #16
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Return the value of cell based from 2 criterias

    Please change the Plus sign to ampersand

    C2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12&'Admin Scale'!$C$2:$Z$12=A2&B2)*'Admin Scale'!$A$2:$A$12,))

    D2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12&'Admin Scale'!$C$2:$Z$12=A2&B2)*'Admin Scale'!$C$1:$Z$1,))
    Attached Files Attached Files

  17. #17
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by alansidman View Post
    Any thoughts on my solution in Post #3. Have you even tried it?
    Hello alansidman,

    the code is perfect! i just tried it.. thank you so much for your effort. However , is it not possible with a formula? Instead of code? my colleagues wont understand coding. This issue bothers us since the start of this year :P

    Thank you again.

  18. #18
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Return the value of cell based from 2 criterias

    If you attach the code to a Command Button, then all they need to know is "Click On the Button."

  19. #19
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by alansidman View Post
    If you attach the code to a Command Button, then all they need to know is "Click On the Button."
    Hi, yes i did that i will reference this in my future projects. thank you so much!
    Attached Images Attached Images

  20. #20
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520

    Re: Return the value of cell based from 2 criterias

    Quote Originally Posted by Bo_Ry View Post
    Please change the Plus sign to ampersand

    C2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12&'Admin Scale'!$C$2:$Z$12=A2&B2)*'Admin Scale'!$A$2:$A$12,))

    D2
    =MAX(INDEX(('Admin Scale'!$B$2:$Y$12&'Admin Scale'!$C$2:$Z$12=A2&B2)*'Admin Scale'!$C$1:$Z$1,))
    hi, working perfect! thank you so much for all your efforts. this saves me months of working.

+ 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 result based on multiple criterias
    By Andrea76 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-25-2020, 04:59 AM
  2. [SOLVED] Return value based on multiple criterias?
    By Busk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2019, 05:12 AM
  3. [SOLVED] how to return cell value based on criterias
    By MyStix01 in forum Excel General
    Replies: 5
    Last Post: 11-26-2018, 07:33 PM
  4. Return 1st value of duplicates based on multiple criterias
    By Dahlia in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-31-2015, 04:09 AM
  5. [SOLVED] Return Column Number Based on Two Criterias
    By taccoo73 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-14-2014, 02:51 PM
  6. [SOLVED] Return first value (duplicates) based on multiple criterias
    By krdka in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-15-2013, 06:11 PM
  7. [SOLVED] Return MAX date based on two criterias
    By cedequ in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-04-2013, 05:11 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