+ Reply to Thread
Results 1 to 14 of 14

vlookup with IF statements?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Canada
    MS-Off Ver
    MS365 Version 2401
    Posts
    130

    vlookup with IF statements?

    Hi All,

    I have a file with some data that I need to summarise based on the location.

    I need to bring in the data for Type and Total into the Formula worksheet whenever I filter for Location. (see attached)

    I am thinking it needs a vlookup with a couple of IF statements or and IFAND statements? not sure.

    Any help is appreciated.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    Since there can be multiple matches, I'll assume that you want to list those matches going down columns C and D.

    Try this:

    C3 =IFERROR(INDEX(Data!B:B,SMALL(IF(Data!$A$2:$A$37=$B$3,ROW(Data!$A$2:$A$37)),ROWS($1:1))),"") Ctrl Shift Enter

    Drag the formula to D3 then down as far as needed.

  3. #3
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Canada
    MS-Off Ver
    MS365 Version 2401
    Posts
    130

    Re: vlookup with IF statements?

    Hi 63falcondude,

    Sorry, I think I messed up on my request and I apologise.

    What I am trying to get do is to have the formula populate the types with the total based on me changing the location. (see attached updated file).

    Once again I apologise for my previous mistake.

    Thanks!
    Attached Files Attached Files

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: vlookup with IF statements?

    Quote Originally Posted by 63falcondude View Post
    Since there can be multiple matches, I'll assume that you want to list those matches going down columns C and D.

    Try this:

    C3 =IFERROR(INDEX(Data!B:B,SMALL(IF(Data!$A$2:$A$37=$B$3,ROW(Data!$A$2:$A$37)),ROWS($1:1))),"") Ctrl Shift Enter

    Drag the formula to D3 then down as far as needed.
    That formula needs to be entered using CTRL SHIFT ENTER, not just enter. Looks like 63 forgot to mention that (I know I have, a few times already lol)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Canada
    MS-Off Ver
    MS365 Version 2401
    Posts
    130

    Re: vlookup with IF statements?

    Or is it an Index Match statement?

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    If I am understanding you correctly, that's what the formula in post #2 does.

    For example, when B3 is 10010, the Types would be 1 Bed and 2 Bed and the Totals would be 4.5 and 3.1.

    When B3 is changed to let's say 10021, the Types would be 1 Bed, 2 Bed, and BACHELOR and the Totals would be 3.8, 2.5, and 4.0.

    Is this not what you want?

  7. #7
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Canada
    MS-Off Ver
    MS365 Version 2401
    Posts
    130

    Re: vlookup with IF statements?

    Hi 63falcondude,

    Forgive my ignorance, but is it possible for you to do the formula in the example file I attached so that I can see how it works for the locations?

    I tried it but couldn't get it to work the way it should.

    I am new to these extensive formulas, hence the inability to make it work.

    Thanks!

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    Sure. Attached is the sample from post #1 with the formula from post #2. Note that I edited the drop-down to include everything.

    I dragged the formula down through row 10.
    Attached Files Attached Files

  9. #9
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    Quote Originally Posted by FDibbins View Post
    Looks like 63 forgot to mention that
    It's shown in the bold part of post #2.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: vlookup with IF statements?

    oops missed that, apologies

  11. #11
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    I think the O.P. may have missed it as well. No worries! Let's see if that was the culprit.

  12. #12
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Canada
    MS-Off Ver
    MS365 Version 2401
    Posts
    130

    Re: vlookup with IF statements?

    Hi 63falcondude,

    Thanks for the example.

    Now I get it and it works! I did miss the Ctrl Shift Enter. Thank you both for your help.

    Cheers!

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: vlookup with IF statements?

    As long as you got where you needed to be. That CSE thing is easy to overlook or forget
    Thanks for the feedback

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: vlookup with IF statements?

    Glad we could help. Thanks for the rep!

+ 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. Using if statements with vlookup
    By redalert787 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-08-2018, 01:49 PM
  2. Vlookup, IF and THEN statements together
    By rsanti in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-03-2013, 04:44 PM
  3. vlookup or maybe IF and AND statements? What do i need to use?!
    By aside10 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2013, 07:46 AM
  4. Vlookup & if statements
    By Nicola13 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-04-2012, 11:55 AM
  5. Excel 2007 : IF/AND Statements and VLookup
    By dchuck in forum Excel General
    Replies: 9
    Last Post: 09-07-2011, 04:48 PM
  6. can I use =if with vlookup statements
    By suzyque in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-31-2006, 12:50 PM
  7. Vlookup and if statements
    By memac19 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 10-20-2005, 07:53 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