+ Reply to Thread
Results 1 to 13 of 13

If function and vlookup with merged cells?

  1. #1
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Post If function and vlookup with merged cells?

    Hi Guys,

    I'm looking to pull data from Sheet-2 onto Sheet-1 Summary table (see attached).

    Issue is that I have merged cells/headers on row-1 (e.g. US, UK, Japan). I understand that creating drop-down list using merged cells is probably not ideal, so open to other suggestions for creating a drop-down without blanks.

    Basically what I want to see on the summary table (sheet-1), is that whatever value I pick on the drop down list, the corresponding monthly and yearly costs should populate from sheet-2.


    Any insight on what logic and functions i could apply would be greatly appreciated.

    Cheers!
    Varun
    Attached Files Attached Files

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,371

    Re: If function and vlookup with merged cells?

    Put this on C5, and ENTERED as ARRAY FORMULA, then copied down and cross:

    =IFERROR(INDEX(Prices!B$3:$G$6,SMALL(IF((INDEX(Prices!$B$3:$G$6,0,MATCH($C$3,LOOKUP(COLUMN(Prices!$B$1:$G$1),COLUMN(Prices!$B$1:$G$1)/(Prices!$B$1:$G$1<>""),Prices!$B$1:$G$1),0))<>""),MATCH(ROW(Prices!$B$3:$B$6),ROW(Prices!$B$3:$B$6)),""),ROW(A1)),MATCH($C$3,LOOKUP(COLUMN(Prices!$B$1:$G$1),COLUMN(Prices!$B$1:$G$1)/(Prices!$B$1:$G$1<>""),Prices!$B$1:$G$1),0)),"-")
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Re: If function and vlookup with merged cells?

    Thanks Azumi!

    Would really appreciate if you could help explain what you have proposed. I'm not well versed with IFERROR, INDEX, SMALL, functions.

    Just curious but is this the only way/approach to solve this? This seems a bit too complex
    Last edited by vloomz; 07-25-2018 at 11:23 PM.

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,918

    Re: If function and vlookup with merged cells?

    Another way:

    =VLOOKUP($B5,Prices!$A$3:$G$6,MATCH($C$3,Prices!$A$1:$G$1,0)+(C$4="Yr"),0)

  5. #5
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Re: If function and vlookup with merged cells?

    thank you! this worked on my sheet and much more easy to understand and apply. Just one quick question - what purpose does the +(C$4-"Yr") serve in the formula?

    Thanks a lot!

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,918

    Re: If function and vlookup with merged cells?

    (C$4="Yr") -> result is true or false

    +false -> +0

    +true -> +1

    like this

    +if(C$4="Yr",1,0)

  7. #7
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Re: If function and vlookup with merged cells?

    sorry Phuocam, still couldn't understand.

    Would you mind elaborating on this piece of logic plz: MATCH($C$3,Prices!$A$1:$G$1,0)+(C$4="Yr"),0)

    Thank you!!

  8. #8
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,334

    Re: If function and vlookup with merged cells?

    The MATCH section of the formula is being used to determine the column to be returned in the VLOOKUP. The TRUE/FALSE statement adds one or zero to the column number. The 0 after it is the final statement in the VLOOKUP, telling it to return an exact match.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,918

    Re: If function and vlookup with merged cells?

    MATCH($C$3,Prices!$A$1:$G$1,0) result is 2,4,6

    +(C$4="Yr"):

    C$4= Month then result is 2,4,6

    D$4 = Yr then result is 3,5,7

  10. #10
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Re: If function and vlookup with merged cells?

    Thanks AliGW! appreciate the clarification

  11. #11
    Registered User
    Join Date
    07-25-2018
    Location
    NY
    MS-Off Ver
    2016
    Posts
    7

    Re: If function and vlookup with merged cells?

    awesome! this is making some sense now

    Quick ques Phuocam:

    Could you explain how does MATCH($C$3,Prices!$A$1:$G$1,0) gives results of 2,4,6?

    Sorry for asking too many questions, but you have been really great!

  12. #12
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,334

    Re: If function and vlookup with merged cells?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  13. #13
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,334

    Re: If function and vlookup with merged cells?

    It returns the column number of the match in the array.

+ 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. Vlookup and merged cells
    By hkaric in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-08-2017, 10:42 AM
  2. Vlookup with merged cells
    By looeej in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-20-2016, 12:24 AM
  3. Using Vlookup when cells are merged
    By Raoel05 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-02-2013, 08:34 AM
  4. VLOOKUP for merged cells
    By Spreadsheet in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-27-2013, 05:48 PM
  5. How do I use the vlookup function with merged cells?
    By kevin76 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-22-2013, 08:30 PM
  6. [SOLVED] Using Vlookup with merged cells...
    By Regnab in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-10-2013, 09:39 AM
  7. VLOOKUP across merged cells
    By WAR in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-28-2005, 02:05 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