+ Reply to Thread
Results 1 to 23 of 23

How to lookup values and get results in specific formats?

  1. #1
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    How to lookup values and get results in specific formats?

    I have a workbook with a tabular data (file attached).

    Now, I'm trying to lookup values in a different workbook using the table shown in the attached file. I only need the columns "RefNo" & "EntryNo" where the lookup value will find a match with column "RefNo" and extract only the text portion from column "EntryNo" & according to that show the result.

    Basically, 1) if the "EntryNo" value have either of the texts "WAMCP" or "WSILCP" or "WJCP" then the result should show as "CAPITAL", 2) if the "EntryNo" value have either of the texts "WAMOP" or "WSILOP" or "WJOP" then the result should show as "CLINIC", 3) if the "EntryNo" value have either of the texts "WAMPRP" or "WSILPRP" or "WJPR" then the result should show as "PROCEDURE", 3) if the "EntryNo" value have either of the texts "WAMPP" or "WSILPP" or "WJPI" then the result should show as "PHARMA" etc. and no match is found then it should be the text "Not Found".

    I've tried the below code but it is long and doesn't work
    Please Login or Register  to view this content.
    Can anyone help?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2403)
    Posts
    370

    Re: How to lookup values and get results in specific formats?

    I am sure the gods of this forum can make a shorter one but this seems to work

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    Thanks for replying. I need to do some sort of lookup as the workbook where I want the result is different than where the table is. The workbook where I want the result looks like
    Untitled.jpg

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,920

    Re: How to lookup values and get results in specific formats?

    or try below formula
    =IFERROR(LOOKUP(LOOKUP(9^9,(SEARCH({"WAMCP","WSILCP","WJCP","WAMOP","WSILOP","WJOP","WAMPRP","WSILPRP","WJPR","WAMPP","WSILPP","WJPI"},A10)>0)*{1,2,3,4,5,6,7,8,9,10,11,12}),{1,4,7,10},{"CAPITAL","CLINIC","PROCEDURE","PHARMA"}),"Not Found")
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    In J10
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Now, I'm trying to lookup values in a different workbook using the table shown in the attached file. I only need the columns "RefNo" & "EntryNo" where the lookup value will find a match with column "RefNo" and extract only the text portion from column "EntryNo" & according to that show the result.
    This is not clear.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 02-07-2024 at 03:32 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    Hi, @samba_ravi & @kvsrinivasamurthy

    Thanks for sharing your version of the formula but will it work in Office 2010 ?
    Also, do you mind explaining your formula and how to use it ? Like I mentioned before in one of my above posts I want the result in a different workbook which looks like
    Attachment 858742

    I want to use the lookup value as the cells of column "InvNo". Hope you understand my requirement.
    Last edited by 0Cool; 02-07-2024 at 09:43 AM.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2412 (Windows 11 24H2 64-bit)
    Posts
    88,706

    Re: How to lookup values and get results in specific formats?

    You have Excel 2019 in your profile - if solutions have to work in 2010, then remove 2019 from your profile, please, otherwise members will be wasting thweir time. Your profile should contain only ONE version: the OLDEST version that solutions must work for.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Attachment not opening. Upload file like post#1.

  9. #9
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    Quote Originally Posted by kvsrinivasamurthy View Post
    Attachment not opening. Upload file like post#1.
    Just see the image in post #3.

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Formula works in 2010 version.

  11. #11
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    Ok, can you explain your formula and how to use it in the use case mentioned in post#6 ?

    Thanks in advance

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    18,500

    Re: How to lookup values and get results in specific formats?

    Just see the image in post #3.
    We cannot test formulas on an image.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  13. #13
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    Here you go.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Pl give the expected result's in Column C and explain how it is done.

  15. #15
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to lookup values and get results in specific formats?

    Possible solution.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    I've added the expected result's in Column C (Result.xlsx). Basically, a vlookup or something like that should use the data in Column B(Result.xlsx) as lookup value then use the table in DATABASE.xlsx as table array, get the values from the column "EntryNo" (DATABASE.xlsx) and convert them using the logic(mentioned below) and put then in Column C (Result.xlsx) as the desired result

    Basically, 1) if the "EntryNo" value have either of the texts "WAMCP" or "WSILCP" or "WJCP" then the result should show as "CAPITAL", 2) if the "EntryNo" value have either of the texts "WAMOP" or "WSILOP" or "WJOP" then the result should show as "CLINIC", 3) if the "EntryNo" value have either of the texts "WAMPRP" or "WSILPRP" or "WJPR" then the result should show as "PROCEDURE", 3) if the "EntryNo" value have either of the texts "WAMPP" or "WSILPP" or "WJPI" then the result should show as "PHARMA" etc. and no match is found then it should be the text "Not Found".
    I hope I've made it clear enough.
    Attached Files Attached Files

  17. #17
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    In D2 of 'Result' file copied down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Both the files should be in same folder. Otherwise for DATABASE file we have to add path of the file.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    I've downloaded your files. It's not working as desired. All results return the value "CAPITAL" in the column D. Did it work for you ? Then why is it not working for me ?

  19. #19
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Row5
    S04/23-24/11 Matching value WJCP0022 Matching value is CAPITAL (post#1)
    You have shown as PHARMA.
    Pl explain
    Same for ROW 6

  20. #20
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    S04/23-24/11 Matching value WJCP0022 Matching value is CAPITAL (post#1)
    You have shown as PHARMA.
    You are right there, sorry for that.

    But for ROW 6 i.e. SOA588357509144 matching value WAMOP0103, so the correct result should be CLINIC like I mentioned before.

    2) if the "EntryNo" value have either of the texts "WAMOP" or "WSILOP" or "WJOP" then the result should show as "CLINIC",
    I'm once again adding the files with slightly changed Result.xlsx file for covering various type of "Category" as results.
    Attached Files Attached Files

  21. #21
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Modified formula in D2.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Use same DATABASE file in last post#.
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    2010
    Posts
    69

    Re: How to lookup values and get results in specific formats?

    It is working! Thanks

    One last thing, do you mind explaining your formula for me to better understand it ?

  23. #23
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to lookup values and get results in specific formats?

    Please Login or Register  to view this content.
    Brief explanation of formula.

    INDEX([DATABASE.xlsx]Sheet1!$A$10:$A$16,MATCH($B2,[DATABASE.xlsx]Sheet1!$G$10:$G$16,0))
    Selects match value for B2 in Column A of DATABSE ie WAMCP0002

    LEFT(INDEX([DATABASE.xlsx]Sheet1!$A$10:$A$16,MATCH($B2,[DATABASE.xlsx]Sheet1!$G$10:$G$16,0)),MIN(FIND({0,1,2,3,4,5,6,7,8,9}
    Takes the alphanumeric value WAMCP

    INDEX({"CAPITAL","CLINIC","PROCEDURE","PHARMA"},AGGREGATE(15,6,C.................
    Finds the value for WAMCP ie CAPITAL

    IFERROR Gives NOT FOUND in case Matching not found at any stage.

+ 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] Vlookup problem (for same lookup values having different results)
    By gautamvats4796 in forum Excel General
    Replies: 5
    Last Post: 05-09-2019, 12:00 PM
  2. How to gel all results for lookup values through vlookup or any other function
    By sathi_kalesh in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-19-2019, 09:12 PM
  3. How to lookup values and placing the results in shapes
    By waimea in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-08-2019, 02:27 PM
  4. Replies: 4
    Last Post: 05-19-2015, 08:42 PM
  5. How to lookup values that has multiple results
    By derricklly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2011, 10:13 PM
  6. Lookup values, match, then take MAX from results
    By mpendle in forum Excel General
    Replies: 4
    Last Post: 01-08-2009, 09:43 AM
  7. Lookup results from anouther worksheet and display specific ones
    By kanuvas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2008, 12:46 PM

Tags for this Thread

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