+ Reply to Thread
Results 1 to 17 of 17

Complex V Look up formula

Hybrid View

  1. #1
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Complex V Look up formula

    Hello,

    I have a slightly complex V Look up formula I am trying to compile.

    I have some data in a workbook that looks like this: data.PNG from which I would like to extract data from into another workbook through V Look up.

    I want the formula to search fore records with particular project numbers, in this case the project number in cell I2, and within the paint department (Column E). Once these records are found I then would like a sum of the hours in the K, N, Q and T columns. (The blue highlighted rows are the rows which meet the criteria to be summed up).

    It is the hours I would like to be totaled and show in the cell H3 in this second workbook: vlookup.PNG

    Can someone help me wrap my head around the complex formula needed?

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,503

    Re: Complex V Look up formula

    Attach a sample workbook as we cannot work with images.

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

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

    Re: Complex V Look up formula

    If you post a workbook instead of pictures it will be much easier to help you
    <----- 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.

  4. #4
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Ok John and Jacc, thanks! Here are the 2 workbooks attached to onedrive:

    Here is the data workbook: https://1drv.ms/x/s!AiBf_qIewMKygQeLgBVLQwTKxf5v

    Here is the 2nd workbook where I would like the vlook up to be done: https://1drv.ms/x/s!AiBf_qIewMKygQjLtfISM4JDBAy8

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,503

    Re: Complex V Look up formula

    Please post w/books on this forum as many members will not visit file-hosting sites.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Quote Originally Posted by JohnTopley View Post
    Please post w/books on this forum as many members will not visit file-hosting sites.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    I'm sorry but the attach option on this forum is not working for me hence why I uploaded it to One Outlook One Drive which is really safe...

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,503

    Re: Complex V Look up formula

    If you follow the instructions provided you will be able to attach a workbook.

  8. #8
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Ok,I believe I have now attached the files. Thanks!
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,503

    Re: Complex V Look up formula

    Try

    in H4

    =SUMPRODUCT(([data.xlsx]Sheet2!$K$2:$U$9)*([data.xlsx]Sheet2!$H$2:$H$9=$C3)*(ISNUMBER(SEARCH("HOURS",[data.xlsx]Sheet2!$K$1:$U$1))))

  10. #10
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Quote Originally Posted by JohnTopley View Post
    Try

    in H4

    =SUMPRODUCT(([data.xlsx]Sheet2!$K$2:$U$9)*([data.xlsx]Sheet2!$H$2:$H$9=$C3)*(ISNUMBER(SEARCH("HOURS",[data.xlsx]Sheet2!$K$1:$U$1))))
    That works perfectly! Thank you John!!!

  11. #11
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Hi John, the code you gave me works but when I try and amend the code for the actual form I am using, I run into issues. I'm not sure if it is because the actual workbook I am using to be looked up is a XLSM document type (XLSM)?...

    Can you take another look please? I have re attached modified work books.

    Could you also extend the v look up code for the total hours for both the paintwork and electrical departments for the project number 2016110340, which can be found in row 2 and row 9?...

    Thank you!
    Attached Files Attached Files

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

    Re: Complex V Look up formula

    Try pasting the following formula into Sheet1!J6:
    Formula: copy to clipboard
    =SUMPRODUCT(('[Work Schedule.xlsm]Data'!$K$2:$U$50)*('[Work Schedule.xlsm]Data'!$I$2:$I$50=$C6)*('[Work Schedule.xlsm]Data'!$E$2:$E$50=I$4)*(ISNUMBER(SEARCH("HOURS",'[Work Schedule.xlsm]Data'!$K$1:$U$1))))
    1) With J6 still selected press Ctrl + C,
    2) Select L6,
    3) Press Ctrl + V.
    Let us know if you have any questions.
    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
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Hi,

    The formula doesn't seem to be working...it asks me to update the location source of the data, which is how I get this:

    =SUMPRODUCT(--('C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$E2:$E50="Paintwork"),--('C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$I$2:$I$50=C6),('C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$K$2:$K$50+'C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$N$2:$N$50+'C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$Q$2:$Q$50)+'C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\[Work Schedule.xlsm]Data'!$T$2:$T$50)
    It returns a value of XVALUE! back.

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,732

    Re: Complex V Look up formula

    I don't recognize the formula as being John's or mine, however I think that if you get rid of the "C:\Users\sony\Desktop\Electronic Work Schedules\Electronic Work Schedules\" part inside each of the brackets it will work, providing Work Schedule.xlsm is open.
    Here are copies of the two workbooks with the formulas I suggested applied. In J6 the formula yields 130 and in L6 the formula yields 20.
    Let us know if you have any questions.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Thanks Jete. Doing as you suggested leaves me with the formula
    =SUMPRODUCT(('Work Schedule.xlsm]Data'!$K$2:$U$50)*('Work Schedule.xlsm]Data'!$I$2:$I$50=$C6)*('Work Schedule.xlsm]Data'!$E$2:$E$50=I$4)*(ISNUMBER(SEARCH("HOURS",'Work Schedule.xlsm]Data'!$K$1:$U$1))))
    Unfortunately I get this error...

    error.PNGerror.PNG

    My xlsm file is titled 'Work Schedule'...perhaps the space in the title is causing the problem?...

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,732

    Re: Complex V Look up formula

    Just looking at the screen shots the square brackets before the 'W' in the word 'Work' is missing.
    I believe it should look like: =SUMPRODUCT(('[Work Schedule.xlsm]Data'!$K$2:$U$50)*('[Work Schedule.xlsm]Data'!$I$2:$I$50=$C6)*('[Work Schedule.xlsm]Data'!$E$2:$E$50=I$4)*(ISNUMBER(SEARCH("HOURS",'[Work Schedule.xlsm]Data'!$K$1:$U$1))))
    Let us know if you have any questions.
    Last edited by JeteMc; 02-15-2017 at 11:54 PM. Reason: added formula

  17. #17
    Registered User
    Join Date
    09-06-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    69

    Re: Complex V Look up formula

    Ok, the form looks like this. It is the last section combo box

    form.PNG

    section4.PNG

    The code is:
    Private Sub SaveData()
      'Save the data from the controls into current row
      Dim C As MSForms.Control
      Dim varValue As Variant    'Must be variant to accept different types of data
      
        For Each C In Me.Controls
            If C.Tag <> "" Then
                'Get the value from the control
                varValue = C.Value
                Select Case C.Tag
                    Case "A", "C", "G", "H", "I", "J", "M", "P", "S"
                        'These are a direct copy of their values to the worksheet
                        Worksheets("Data").Range(C.Tag & ThisRow.Row) = varValue
                
                
                 Case "K", "L", "N", "O", "Q", "R", "T", "U"
                        If WorksheetFunction.IsText(C.Tag) Then   'Tests if "Complete" selected from DropDown
                            Worksheets("Data").Range(C.Tag & ThisRow.Row) = varValue
                        Else
                            'If not text thenthis value is a double number so convert text number to double number
                            Worksheets("Data").Range(C.Tag & ThisRow.Row) = CDbl(varValue)
                        End If
                
                
                
            
                    Case "B", "D"
                        'These values must be valid dates so convert text date to date value
                        If IsDate(varValue) Then
                            Worksheets("Data").Range(C.Tag & ThisRow.Row) = CDate(varValue)
                        End If


    Private Sub UserForm_Initialize()
        'A textbox for the ID and TimeStamp was missing on the form
        Me.TextBox1.Tag = "A" 'ID
        Me.TextBox2.Tag = "B" 'TimeStamp
        'You can hide it:
        'Me.TextBox1.Visible = False
        'Me.TextBox2.Visible = False
        
        'Your controls:
        Me.listGL.Tag = "C"
        Me.listDate.Tag = "D"
        Me.listEmployee.Tag = "G"
        Me.listProjectName.Tag = "H"
        Me.ProjectNumber.Tag = "I"
        
        
        Me.listSection1.Tag = "J"
        Me.listTask1.Tag = "K"
        Me.listHours1.Tag = "L"
    
        Me.listSection2.Tag = "N"
        Me.listTask2.Tag = "O"
        Me.listHours2.Tag = "P"
    
        Me.listSection3.Tag = "R"
        Me.listTask3.Tag = "S"
        Me.listHours3.Tag = "T"
    
        
        Me.listSection4.Tag = "V"
        Me.listTask4.Tag = "W"
        Me.listHours4.Tag = "X"
    
        
        
        
    End Sub

+ 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] Use an existing cell formula for creating a new more complex formula
    By dubcap01 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-23-2014, 07:41 AM
  2. complex AVG formula
    By koosh1986 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-22-2014, 06:46 PM
  3. [SOLVED] Complex IF Formula
    By tomvh444 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-12-2014, 10:31 AM
  4. Complex IF formula
    By elanum in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-12-2013, 08:12 PM
  5. Complex IF Formula
    By elanum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2013, 09:16 AM
  6. Formula too complex
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-13-2011, 09:36 PM
  7. Can someone help with this complex formula?
    By My2Boyz9802 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-21-2006, 12:12 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