+ Reply to Thread
Results 1 to 10 of 10

shorter expression of lookup formula

  1. #1
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Question shorter expression of lookup formula

    can you suggest me shorter expression of this lookup formula

    Please Login or Register  to view this content.
    the idea is that i have a list of numbers which have different equivalent value like:
    14 = 7.5
    15 = 8
    16 = 9

    and so on..

    i count how many times in a row we have 14 and then look it up in a separate table "T_NS" and get their relative value and multiply it...
    is there a shorter way to express this lookup, because the numbers that i need to lookup are approximately 100
    Truth fears no questions.

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: shorter expression of lookup formula

    You could create the following Function to cycle through them all and come up with the answer.

    Ive put the starting numbers in an array string but you could easily change that to a range of cells etc

    Please Login or Register  to view this content.
    Last edited by pjwhitfield; 12-14-2016 at 06:05 AM.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: shorter expression of lookup formula

    does this even work? I tried a shorter version and cannot get it to work. so according to your formula if you count the number of times 14 shows up in that section of row 9 you then want to multiply it by the value in T_NS so what if 14 appears 5 times and 15 appears 5 times, how does it differentiate? Could you post a small sample sheet with your expected results?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: shorter expression of lookup formula

    My understanding is that the 14, 15 etc have lookup values so its "how many times 14 appears multiplied by the lookup value relating to 14"

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: shorter expression of lookup formula

    My understanding is that the 14, 15 etc have lookup values so its "how many times 14 appears multiplied by the lookup value relating to 14"
    I get that but I still don't see how if 14 appears 5 times and so does 15 how it will differentiate. I'm interested in seeing how this progresses. I'd go with a helper column then the lookup but I have no ability to write vba as you do.

  6. #6
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: shorter expression of lookup formula

    I think that theres potential for the helper columns to be a more sensible solution if Im being honest.

    The lookup value for 14 was 7.5 while 15 was 8 therefore there would be a 2.5 difference if there were 5 of each (5 x 7.5 and 5 x 8) ....or have I misread the whole thing (easily believable!)

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: shorter expression of lookup formula

    Hi,

    To avoid us all guessing and wasting time, please upload a sample representative workbook and manually add the results you expect to see with notes as appropriate to explain your calculation.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  8. #8
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: shorter expression of lookup formula

    Try this array formula (must be enter with CTRL+SHIFT+ENTER)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where T_NS1 is the first column of the table T_NS

    and T_NS6 is the sixth column of the table T_NS

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

    Re: shorter expression of lookup formula

    Load this macro into a macro module

    Please Login or Register  to view this content.
    Then this formula will do what you ask for the numbers 3, 4, 5, 6

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


    this can be easily extended


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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.

  10. #10
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: shorter expression of lookup formula

    thank you all for the efforts and dedication - i appreciate it

    the whole idea of the formula was to calculate the compensation hours for night shift
    so i was counting how many times the employee took shifts from 8 o clock 9 10 and so on
    then im looking up the shift number in another table to get how many hours night shift hours are worked and then multiply it by the respective number of shifts
    then i divide it by 60 minutes so i can get the hours for compensation

    i did this setup in the beginning, but then i found another setup by calculating the coefficient

+ 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. Explanation of this expression LOOKUP(1,1/(A:A=D1),ROW(A:A))
    By williewolf in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 10-21-2016, 12:13 PM
  2. Make this formula shorter
    By Challebjoern in forum Excel General
    Replies: 16
    Last Post: 10-15-2015, 01:28 AM
  3. Make a formula shorter
    By PatrikIden in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-03-2014, 01:45 PM
  4. How can I make this code shorter by using Lookup and goto functions cause im really new
    By romarkevinruiz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-10-2014, 07:44 AM
  5. Shorter formula
    By fivermsg in forum Excel General
    Replies: 3
    Last Post: 01-03-2008, 04:55 PM
  6. [SOLVED] Need faster/shorter formula
    By Luke in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-10-2005, 12:15 PM
  7. [SOLVED] Shorter Formula
    By Pete in forum Excel General
    Replies: 2
    Last Post: 02-18-2005, 12:06 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