+ Reply to Thread
Results 1 to 5 of 5

Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    21

    Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

    This is my first post - so please forgive me if I'm missing any pertinent info! I've attached an example of my workbook to help make sense of what I'm trying to do...

    Example.xlsm

    Basically, I pull a report from our database and import it into a new sheet (the sheet titled "Load Hrs" in my example) in an existing workbook that already contains a sheet with a table of data (the sheet titled "Faculty Seniority List in my example.) Right now, I have inserted four new columns into my imported sheet & each column has its own formula to get the results I'm looking for, but I know there HAS to be a way to write a formula that would combine the 4 formulas in each column into 1 formula. I suspect this would involve a nested vlookup & sumif into a pretty hefty IF statement, but I'm somewhat of a novice at complex formulas and I'm hoping someone can help!

    So here's what I did:

    1. In column J, I want to look up the last name (cell F2) in Table3 to find the faculty member's status and display their status in J2 (however I'm running into a problem that I'm not sure how to fix when there are two people with the same last name - i.e. Cole, Paul vs. Cole, Chuck)

    2. In column K, I want to look up every occurance of the last name (cell F2) and display the sum of all of their contact hours (in this example I don't have the same problem of two people with the same last name, however I do anticipate that problem in the future - so I'd need to figure out how to write this into the formula)

    3. I then inserted columns L & M as a means to get the final results I wanted in column N - only because I couldn't figure out any other way (although I know there is one!) So columns L & M are looking up the status that's displayed in J2 in Table4 in order to display the minimum and maximum hours attributed to that status --> all so I could write the formula in column N to find out if the faculty member's total contact hours are within the allotted range for their status (and tell me if they're over or under - I'd like to get rid of the "false" result when it's within the correct range - but like I said, I'm a novice.)

    The initial imported data could come from a report that I'd run almost daily, and with all of the formatting I have to do first and then updating the formulas to point to the correct cells, I'm hoping to have a formula that I can easily re-use.

    Any ideas on how to combine all of these steps (and eliminate any redundant or unnecessary steps) into one formula?

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

    Hmm... I'm not that satisfied with what I achieved here. It was not easy to improve on, your original setup was pretty good, including the extra columns.
    I did solve the problem with the multiple same last names, it now looks for both first and last name.
    I did use Table references in the formulas. While it makes the formulas a bit bulky they will expand automatically with the tables, a neat feature indeed. But yeah, bulky and hard to read before you get used to it.
    The conditional formatting is also set to the table and will expand with it (I think )

    In theory it would be possible to combine all formulas into one but why would you? In six month the inner workings of a monster formula like that will be forgotten and anyone trying to update this setup is in for a nightmare trying to dechiffer it.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

    How do you get the original data into Excel by the way? If this is something you do daily then there may be time to save there.

  4. #4
    Registered User
    Join Date
    04-29-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

    Thanks for your help! I continued to work on it too and came up with an alternate work around for the multiple last names after I realized that even though that two sheets were pulling the data from the same database (and thus the names should be output in the same way) it seemed that there were some cases where the first name was also showing a middle initial after it on one sheet but not on the other - argh! (i.e.: my original "Faculty Seniority List" sheet had a name column that would read "Thompson, Earl S." and my original "Load Hrs" sheet would have a last name column with "Thompson" and a first name column with "Earl" and the "S." was nowhere to be found....)

    So on the original "Faculty Seniority List" sheet I inserted a few extra columns, and then ran a "text to columns" on the name so as to separate it out and delete the column with the middle initials. Then in another newly inserted column, I used a concatenate formula to re-combine the name without the middle initial. I then copied and pasted the values only into yet another newly inserted column. Then on my "Load Hrs." sheet I inserted a few extra columns and entered a concatenate formula again (copying and pasting the values into another new column) so that my vlookup formula would return the correct value despite there being multiple people with the same last name.

    Example.xlsm


    I also played around with the "Hours OK?" formula a bit in order to eliminate the min/max helper columns I had inserted so it reads like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I was thinking the same thing about the named table references

    All that being said - you're right - 6 months from now the inner workings would SURELY be forgotten, and with the data being imported on a frequent basis (via importing a text file saved from our Datatel UI database), I'm fine with what I've got and I'm currently working on writing a macro that will do all of this for me..... but that's a whole other thread!

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Nested VLOOKUP & SUMIF in IF STATEMENT with several variables

    Sounds that you are doing alright.

+ 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. Syntax for a conditional or nested SUMIF statement
    By teacherofkids in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2013, 01:50 PM
  2. how to created nested if statement using SUMIF
    By Seb62 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-04-2013, 09:01 AM
  3. Nested SUMIF statement or multiple SUMIF's
    By Dan27 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2009, 06:55 AM
  4. Nested SumIf statement
    By jlhart76 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-18-2006, 12:27 PM
  5. How do I set up a nested SUMIF formula for a number of variables?
    By Nancy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2006, 02:10 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