+ Reply to Thread
Results 1 to 41 of 41

[HELP] Make a more complex VLOOKUP formula

  1. #1
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    [HELP] Make a more complex VLOOKUP formula

    Hi,
    I have twoexcel documents, "Book1" and "Book2". Book1 is exportedfrom our business system. Book2 is a compilation of forecast from the businesssystem data that were exported.

    Today Ihave to manually put in the data from Book1 to Book2. I want to automate thatprocess.
    In Book2 Ihave dates in row 25 like dec-18, jan-19, feb-19 and so on. I want these datesto be matched with the dates in Book1 that are displayed as 2019-01-05 and soon, which are displayed vertically in column S. If a match is detected I want Book2 to take the data in column R inBook1 associated with the same row of the date and place it in Book2 in thesame date.

    Now I’m using a rangefor the Book1 costs and dates and use VLOOKUP for the cells in BOOK2.

    Problem number 1: Is thatwhen we export the information from our business system, the cost is in the leftcolumn of the dates. VLOOKUP is trying to match the dates of BOOK2 with thecost of column R. How do I manage to change it without changing the original format?

    Problem number 2: Isthat VLOOKUP is matching the dates exactly, I want it to match only the months.
    Problem number 3: Iwant it to sum the costs of the same months and display it as one cost. So forexample January has 2 costs, I want it to display the sum of these costs inBook2 jan-19.
    My question is: is itpossible?

    Formula I'm using now is which isn't working:


    [CODE]=VLOOKUP(P25;(Book1.xls!planerat);2;FALSE)[CODE]

    Also if someonehas a better solution than VLOOKUP, comment it below :D
    Thank you in Advance
    Attached Files Attached Files
    Last edited by lababa; 11-28-2018 at 07:35 AM.

  2. #2
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    I have included an excel dokument.
    Sheet1: Book2
    Sheet2: Desired results of Book2
    Sheet3: Book1
    Last edited by lababa; 11-28-2018 at 07:36 AM.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: [HELP] Make a more complex VLOOKUP formula

    Pictures are confusing

    Attach sample workbook (s) . 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.

  4. #4
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    I Attached one excel file called Example which hold all 3 sheets as explained in the second reply
    Thank you for heads up

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please try at Sheet1 D30

    =SUMPRODUCT(Book1!$Q$3:$Q$10,--(TEXT(Book1!$R$3:$R$10,"mmyy")=TEXT(P$25,"mmyy")))

    and if you want to hide 0 set cell custom format to
    #,##0;;
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    This just sums the whole Q column:
    =SUMPRODUCT(Book1!$Q$3:$Q$10;--(TEXT(Book1!$R$3:$R$10;"mmyy")=TEXT(P$25;"mmyy")))

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Correction, this is just sums the column Q that have column R month and year same as row 25.

    lab.png

  8. #8
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    This is what I get, it seems like your excel is a bit different. I cant put in the formula with commas I think i have to use semicolon between stuff. Otherwise I get a warning sign :/

    newnew.PNG

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Did you download the file from post#5?

    it should automatically change comma to semicolon.

  10. #10
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Wtf this is so strange. When I copy paste the formula to exact same document I have in the computer it shows as the picture above. Did you add anything else that it isn't showing?

  11. #11
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    I have no idea what I'm doing wrong, now your file is showing 30 400 602 on some cells :/

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please check formulas ribbons > Calculation options > check automatic

  13. #13
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    It is automatic. I think the function TEXT(....;"mmyy") is generating the wrong value. When I write it i just get 00yy. Like TEXT(P$25;"mmyy"), it just generates 00yy. How do I fix this?

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Change formula at P30 to

    =SUMPRODUCT(Book1!$Q$3:$Q$10,(MONTH(Book1!$R$3:$R$10)=MONTH(P$25))*(YEAR(Book1!$R$3:$R$10)=YEAR(P$25)))

  15. #15
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    That worked thank you! My next problem is: how can I do it so this formula works for the whole column Q and R in Book1? Because the rows differ from one export to another in our business system. I updated the excel file below so it matches the export from the business systeme exactly. How can I make that work? I would be forever thankful if you could help me with that.
    Attached Files Attached Files
    Last edited by lababa; 11-29-2018 at 03:58 AM.

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please try at P30 and press Ctrl+Shift+Enter

    =SUM(IFERROR(Book1!$R$3:$R$999*(MONTH(Book1!$S$3:$S$999)=MONTH(P$25))*(YEAR(Book1!$S$3:$S$999)=YEAR(P$25)); ))

    At Book1 Number stored as text, and that cause earlier formula not work, also TEXT(xx;"mmyy") because xx suppose to be date(value) not text.

    Not good idea to use whole column in array formula as it will calculate slowly, just change 999 to cover more data if needed.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    It is working with your excel file but when I copy paste in my Example.xlsx it gives only 0, and we have exactly same sheets. This is so frustrating hahah

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Did you press Ctrl+Shift+Enter after enter the formula?

  19. #19
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    I did, nothing happens. What is supposed to happen with Ctrl+Shift+Enter?

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

    Re: [HELP] Make a more complex VLOOKUP formula

    There will be curly bracket around the formula { }

    https://www.excel-easy.com/functions...-formulas.html

  21. #21
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Yep the curly brackets appear but it still shows 0 :/

  22. #22
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi! It works! The problem was that the business system exports numbers with "." is there a way to automaticly convert them on the way to the desired sheet(Sheet1)?

  23. #23
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Or to make excel read the Book1 without "."

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Try Ctrl+H

    find what .
    replace with empty

    Replace all

  25. #25
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Yeah exactly thats how I do it manually. I thought about recording a macro to go to the workbook and remove all the "." on the document that gets exported from the business system.

  26. #26
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi Bo_Ry thank you for all help. Could you please help me with one last thing. When the cost has been booked the date goes to column T. Is there a way to be able to catch this data too? Thank you again!
    Attached Files Attached Files

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Yes, Please try at N30 with Ctrl + Shift + Enter

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

  28. #28
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Thank you soooo much!!

  29. #29
    Registered User
    Join Date
    10-30-2018
    Location
    London
    MS-Off Ver
    excel 2010
    Posts
    53

    Re: [HELP] Make a more complex VLOOKUP formula

    hi
    do you mean referencing a whole column in excel?

  30. #30
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hello Bo_RY,

    Could you help me display dates in row 29 as the "Desired Results" Sheet in Example excel document. In case of two dates fall in same month, is it possible to display them in one cell?

    I have tried figuring it out with your formula but with S column without any results

    Thank you again!!
    Attached Files Attached Files

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Yes, but you need Textjoin for Excel 365

    P29 Press Ctrl+Shift+Enter drag to the right
    =TEXTJOIN(", ";;IF(TEXT(P$25;"myy")=TEXT(Book1!$S$13:$S$24;"myy");TEXT(Book1!$S$13:$S$24;"yyyy-mm-dd");""))
    Attached Files Attached Files

  32. #32
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi Bo_Ry,
    This isnt working due to I have different format on dates. It just returns strange dates. Is it any way we could make this universal so that it works with any computer that opens this docoment? Like we did before?
    Attached Images Attached Images

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

    Re: [HELP] Make a more complex VLOOKUP formula

    I don't know Swedish format,
    please check your cell date format and change "myy" "yyyy-mm-dd" accordingly. m for month and y for year.

    =TEXTJOIN(", ";;IF(TEXT(P$25;"myy")=TEXT(Book1!$S$13:$S$24;"myy");TEXT(Book1!$S$13:$S$24;"yyyy-mm-dd");""))

  34. #34
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi Bory! Works so good, fixed my language settings!

    The only problem I have right now is that it doesnt pick up the dates from column T in Book1. Is it possible for it to pick column T if column S doesnt have a date? And if neither of them have a date, it just dont show anything just like now? Thank you again!

    I tried
    "=TEXTJOIN(", ";;IF(TEXT(N$25;"MÅÅ")=TEXT(PLR!$S$13:$T$100;"MÅÅ");TEXT(PLR!$S$13:$T$100;"MMM-DD");""))"
    But I got #Value error because it is trying to pick up the total sum in row 25 too...

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please try add iferror and

    =TEXTJOIN(", ";;IFERROR(IF(TEXT(N$25;"MÅÅ")=TEXT(PLR!$S$13:$T$100;"MÅÅ");TEXT(PLR!$S$13:$T$100;"MMM-DD");"");""))

  36. #36
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Thanks bro works like a charm!!

  37. #37
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi again Bo_Ry!

    Could you help me make make a formula that picks column E minus columns G in "Book1" and distribute the answer equally in "Desired Results" from the date in F12 in "Desired Results" to the date N3 in "Book1". See the attached Example for more precise explenation.

    Thank you again!
    Attached Files Attached Files

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please try at D29 drag across

    =IF((D$25>=$F$12)*(D$25<=INDEX(Book1!$N$3:$N$10,MATCH($C29,Book1!$C$3:$C$10,))),INDEX(Book1!$E$3:$E$10-Book1!$G$3:$G$10,MATCH($C29,Book1!$C$3:$C$10,))/(DATEDIF($F$12,INDEX(Book1!$N$3:$N$10,MATCH($C29,Book1!$C$3:$C$10,)),"m")+1),"")
    Attached Files Attached Files

  39. #39
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Hi Bo_Ry,

    I'm trying to develop the formula and I can't seem to get it to work.

    I want it to do the same, but the dates sometimes vary. I want it to sum for the actual month and catch the varying dates and distribute correctly. It only distributes to the date in N3. Is it possible to make it distribute for all dates in Book1 N and sum it for each month in Desired Results horizontially.

    Ctrl+shift+enter:
    =SUM(IF((E$25>=$F$12)*(Book1!$B$3:$B$10="06")*(E$25<=INDEX(Book1!$N$3:$N$10;LEFT(Book1!$C$3:$C$10;7)=$C29));INDEX(Book1!$E$3:$E$10-Book1!$G$3:$G$10;LEFT(Book1!$C$3:$C$10;7)=$C29)/(DATEDIF($F$12;INDEX(Book1!$N$3:$N$10;LEFT(Book1!$C$3:$C$10;7)=$C29);"m")+1);""))
    Attached Files Attached Files

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

    Re: [HELP] Make a more complex VLOOKUP formula

    Please try at D29 press Ctrl+Shift+Enter and drag across

    =SUM((D$25>=$F$12)*(D$25< Book1!$N$2:$N$9)*(Book1!$B$2:$B$9="07")*(Book1!$C$2:$C$9=$C29)*(Book1!$E$2:$E$9 -Book1!$G$2:$G$9)/(IFERROR(DATEDIF($F$12;Book1!$N$2:$N$9;"m"); )+1))
    Attached Files Attached Files

  41. #41
    Registered User
    Join Date
    11-26-2018
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    39

    Re: [HELP] Make a more complex VLOOKUP formula

    Thank you again Bo_Ry!

+ 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] Using IFERROR to Make Complex Formula Ignore Error
    By DGARDNERMAN in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-03-2018, 12:50 PM
  2. [SOLVED] Complex Vlookup Formula
    By douggie in forum Excel General
    Replies: 6
    Last Post: 08-30-2016, 07:04 PM
  3. [SOLVED] Complex Vlookup formula on 2 columns
    By Air^Canada in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-14-2015, 08:47 AM
  4. Experts: Please help me make a ridiculously complex formula more simple!
    By RobFromNZ in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2014, 12:09 AM
  5. Complex Vlookup formula
    By superdonk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2013, 11:58 AM
  6. Complex vlookup formula question
    By dta1984 in forum Excel General
    Replies: 54
    Last Post: 11-18-2011, 12:23 AM
  7. Help with complex formula - H and VLOOKUP
    By supraruss in forum Excel General
    Replies: 8
    Last Post: 07-01-2008, 12:04 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