+ Reply to Thread
Results 1 to 14 of 14

How to nest multiple iferror statements with multiple index matches?

  1. #1
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    How to nest multiple iferror statements with multiple index matches?

    Hi all,

    Wondering if someone can help me.

    I'm trying to combine multiple iferror statements with multiple index matches and I'm not getting the results I'm after. I've attached an example spreadsheet which shows the formula I'm currently trying. The results on line 3 in the 1st tab in green are the correct results I am expecting, but the results in red underneath are what I'm hoping to see...but am not.

    [Context to this - we go to multiple sites which are recorded by "site number" and record how many minutes were spent at each meeting. (There is a formula in the "raw data" tab in column D + E which sort out the order of the dates, creates a reference, which is then used in the formula in the "report" tab to order the data).

    However, a site number could change, yet we still need the data for the old site number to sit alongside the new site number (hopefully the example explains this a bit better).

    This could happen across multiple sites, but for simplicity I've just added in data for 1 site which has changed its site number. ]







    I don't know if its just a simple fix in the way I'm trying to do the formula (I have tried googling this already but with no luck) or my approach is just wrong.

    Any help / advise would be great.


    Thanks !
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to nest multiple iferror statements with multiple index matches?

    Try

    in D3
    =IFERROR(LOOKUP(2,1/(($B3='Raw data'!$A$2:$A$100)*(D$1='Raw data'!$D$2:$D$100)),'Raw data'!$B$2:$B$100),"")
    copy across and down the grid

    in M3
    =IFERROR(LOOKUP(2,1/(($A3='Raw data'!$A$2:$A$100)*(D$1='Raw data'!$D$2:$D$100)),'Raw data'!$C$2:$C$100),"")
    copy across and down the grid
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    Hi Special-K

    Thanks for taking a look into this (and sorry for the delay in replying).

    I tried out the formula but it only gives me the results that I have in green (wihin the attached example). In the first formula, I'm not sure how I reference both the old and new site numbers, as I believe that the formula is only looking at column B? ... but then, I have never used the LOOKUP function before so I could well be wrong !

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to nest multiple iferror statements with multiple index matches?

    OK, I misunderstood
    So the green results are correct using thje LOOKUP formula, yes?

    In H3 change the formula to
    =IFERROR(LOOKUP(2,1/(($A3='Raw data'!$A$2:$A$100)*(D$1='Raw data'!$D$2:$D$100)),'Raw data'!$B$2:$B$100),"")
    and copy across and down

    Q3 formula looks ok.

  5. #5
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    Hi,

    so I would need a formula that can be applied from columns D - K and look in column B first and bring back dates, then look in Column A and bring back dates. Reason being, that it may not always be in column H where dates need to brought back for a new site number, it could be in any of them e.g. an old site only has one date (column D) and then from column E onwards dates should be brought back relating to the new site if that makes sense?

    Essentially, a site could change number at any time in the year. Also, visits aren't always monthly, they could be quarterly, every 2 months etc (so there's no set pattern to follow).
    As such, the same logic applies to columns M-T - that it needs to be able to read the site numbers in both column B and A.


    So the ammended formula does now work in bringing back the dates in red, but is there a way to combine this with your initial formula, so that across the whole section, the formula looks at both the old and new sites?

    Thanks again for your help though !!

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to nest multiple iferror statements with multiple index matches?

    Would it be this?

    =IFERROR(LOOKUP(2,1/((IF($B3<>"",B3,A3)='Raw data'!$A$2:$A$100)*(D$1='Raw data'!$D$2:$D$100)),'Raw data'!$B$2:$B$100),"")

  7. #7
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    So I just tried this and it still only picks up the dates for the old site. I guess because there is data in B3 (i.e. it's not blank), the IF statement doesn't work for what I need it to do because it doesn't know to move onto A3 when there are no more dates left for B3, yet there are dates for A3.

    The more I think about this the more I really don't know if this is possible

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to nest multiple iferror statements with multiple index matches?

    I dont understand your original output.
    Where do you get 2/5/2019 from, it doesnt exist in your Raw Data sheet?

    Try this

    Old site number is 12, new site is 56
    You say old site has only 1 date column D - Ok so column D should relate to old site 12 - result should be 1/1/2019
    So formula for column D would be

    =IFERROR(LOOKUP(2,1/(($B3='Raw data'!$A$2:$A$100)*(D$1='Raw data'!$D$2:$D$100)),'Raw data'!$B$2:$B$100),"")

    Column E onwards relates to new site
    So in column E
    =IFERROR(INDEX('Raw data'!$B$2:$B$9,AGGREGATE(15,6,ROW('Raw data'!$A$2:$A$9)/(('Raw data'!$A$2:$A$9=$A3)),COLUMNS($A1:A1))-1,1),"")
    And copy and paste that formula to columns FGHIJK

    Is that any good?

  9. #9
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    Sorry, that's my fault the dates in red should have been 01/05/20199,01/06/2019,01/07/2019 but for some reason I missed that I'd put those dates in like that.

    The thing is, there could be 20 sites where their numbers have changed and they could have changed after the 1st meeting, the 2nd or the 3rd etc, so there wouldn't be a way of knowing for each site (of which there are almost a 1000 in real life) at what stage they changed and therefore, which column relates to the old vs new site number for all sites i.e, there's no hard and fast rule to say Column D will always = the old site and E onwards will always = the new site. So column G for example may relate to the old site number for some sites and for others, who have never had a site number change, it would only relate to the current site numbers.

    Hence the need for something dynnamic so that, each month when I put the raw data into the "Raw data" tab it quickly populates data into the report (for context, I would know from a seperate summary report I receive when sites have changed numbers and what the new site number is, and I manually update the site numbers ready for when we get the raw data)

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

    Re: How to nest multiple iferror statements with multiple index matches?

    Based on the expected output in the file and the first line of post #9, the following formulas seem to return the correct values.
    For Date:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    *The Time formula is an array entered formula which needs to be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER before being copied to other cells.
    Note that you will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    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.

  11. #11
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    Hi JeteMc,

    thanks so much for taking the time to look at this. I just tried out the formula and it works perfectly !!

    With that first formula, how on earth do you even begin to come up with something like that? I can see what is happening in the 'time' formula with the index matches and if errors, but never in a million years would I have been able to come up with the first one.

    I'm trying to get my head around what the 1st formula is actually doing. I tried to google the Aggregate function but can't quite understand what it's actually doing in this formula. And the Columns function in the end where it's just looking at row A, what does that but do?

    Thanks again!

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

    Re: How to nest multiple iferror statements with multiple index matches?

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.
    As to the AGGREGATE function, one way to think of it, at least in this case, is that it is a way to use an array formula without having to activate the formula using Ctrl, Shift and Enter.
    The first argument, 15, is the SMALL function and the second argument, 6, ignores errors (somewhat like IFERROR).
    So in this case the formula will find the nth* smallest value in column B of the Raw Data sheet where either the value in column A (Raw Data sheet) matches the value in A3 OR (as designated by the +) B3.
    *The last argument, COLUMNS($A$1:A$1), is a counter that will change the nth value from 1st smallest to 2nd smallest to 3rd smallest etc. as the formula is dragged to the right. (I hope that makes sense)
    Let us know if you have any questions.

  13. #13
    Forum Contributor
    Join Date
    05-09-2019
    Location
    South West
    MS-Off Ver
    365
    Posts
    108

    Re: How to nest multiple iferror statements with multiple index matches?

    Thanks so much for taking the time to explain this, that all makes perfect sense. I feel like every day I learn something new about the capabilities of Excel.

    Thank you again for all your help

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

    Re: How to nest multiple iferror statements with multiple index matches?

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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] How To Nest Multiple IF and OR statements...
    By Ourkid123uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2018, 10:40 AM
  2. [SOLVED] Multiple If statements with multiple then statements pulling from Index/Match commands
    By Reggie Wells in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-30-2017, 03:25 PM
  3. [SOLVED] IFERROR + FIND multiple matches
    By Kanuck in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-16-2016, 07:14 PM
  4. [SOLVED] Multiple IFERROR or IFERROR w/ If Statements
    By SanchoPanza1 in forum Excel General
    Replies: 4
    Last Post: 03-31-2016, 08:09 PM
  5. [SOLVED] How to nest INDEX and Match into IF statements?
    By neojihui in forum Excel General
    Replies: 5
    Last Post: 08-20-2015, 05:10 AM
  6. Nest If Statements Dependent on Multiple Cells
    By shanafesta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-22-2015, 12:12 AM
  7. Replies: 4
    Last Post: 07-02-2013, 09:47 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