+ Reply to Thread
Results 1 to 17 of 17

Combining a formula creates different result

  1. #1
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Combining a formula creates different result

    *combining a formula creates different result*

    I just wondered why the following is happening

    The formula in KU2, looks at the value in KT2, for it's calculation. Therefore, to save an unneeded column, I thought replacing "KT2" in the KU2 formula (with the formula in KT2), would give exactly the same result. But for some reason it looks like it's it erroring - & I'm not quite sure why... & the formula isn't very "nice"...!

    Any help would be massively appreciated

    KU2 - KU7 contains the original formula (correct result)

    KU8 - KU13 contains the merged formula (strange error)

    Thanks
    Attached Files Attached Files
    Last edited by AliGW; 04-15-2018 at 04:34 PM.

  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,192

    Re: Combing a formula creates different result

    I don't know what the formulae are attempting to do but I suspect not many of use are unwilling to unscramble it!

    Explain exactly what you are trying to calculate as I find it difficult to believe it cannot be simplified.

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Combing a formula creates different result

    holy something that's one big bad mother of all formula's
    This is the first time in my life I had a brain-freeze without eating ice-cream..


    /me: someone have the phonenumber of Albert Einstein.. he was rather good with complex formulas I heard

  4. #4
    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,192

    Re: Combing a formula creates different result

    Pure coincidence I am sure but

    in KU2

    =IFERROR(INDEX($A$1:$KN$1,MATCH(KT2,$A2:$KN2,0)),"")

    copied down

    gives the same results as your current formula!

  5. #5
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combing a formula creates different result

    Quote Originally Posted by Roel Jongman View Post
    holy something that's one big bad mother of all formula's
    This is the first time in my life I had a brain-freeze without eating ice-cream..


    /me: someone have the phonenumber of Albert Einstein.. he was rather good with complex formulas I heard
    It's funny, what it's actually calculating is quite straightforward - but the amount of stages & caveats, have made so so long!! It's the end result of merging god knows how many formulas already!!

  6. #6
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combing a formula creates different result

    Quote Originally Posted by JohnTopley View Post
    Pure coincidence I am sure but

    in KU2

    =IFERROR(INDEX($A$1:$KN$1,MATCH(KT2,$A2:$KN2,0)),"")

    copied down

    gives the same results as your current formula!
    Nearly John!!

    However, it has to be connected to KS1 & KV1 (variable array size) (your formula works for 300 - 1)

    Also, I believe your formula looks for a perfect match - there's an added complication - where if the value is not present, it needs to do a 2nd check to see if the value was "passed" (i.e. if it was passed, tell me the location of this value, instead of the perfect match) i.e..

    lnH2YoSkTMa4QBIB0r9w7g.png
    Last edited by Median; 04-15-2018 at 04:08 PM.

  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,192

    Re: Combing a formula creates different result

    So what is the basic calculation as the very straightforward one in post #4 worked (as I said more by chance ???).

    What determines the "lookup" value returned from row 1?

    EDIT: so what is the connection with KS1 and KV1 as they appear to be the limits of values in row 1?
    Last edited by JohnTopley; 04-15-2018 at 04:04 PM.

  8. #8
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combing a formula creates different result

    That's right they are the limits.

    The formula is looking for the 1st touch/cross below the value stated in KT - then telling me the position in the total array. A quick example (the "long formula" is below the solid line)

    -G9j-OgdTwiTB87LelhtxA.png

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combing a formula creates different result

    I'd just like to refer to one of my favorite rules of thumb:
    If it ain't broke, don't fix it.

    If you have a working set of formulas, that perform your expected functions, then leave it be.
    Excel gives you over 16,000 columns to work with, it's ok to use a few of them.
    In fact, usually the calculations are more efficient when you split calculations among multiple columns instead of cramming all calculations into a single larger formula.

    If the formula in KU2 refers to KT2 2 or more times, and you combine KT2 into KU2, then that calculation is repeated 2 or more times in KU2. Where it's only done once in KT2 originally.
    Last edited by Jonmo1; 04-15-2018 at 04:26 PM.

  10. #10
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combing a formula creates different result

    Quote Originally Posted by Jonmo1 View Post
    I'd just like to refer to one of my favorite rules of thumb:
    If it ain't broke, don't fix it.
    The only problem, that formula gets duplicated - a lot in my proper sheet, & the amount of time it takes to calculate for all fields (i.e. thousands of rows) gradually gets slower & slower!! I'm convinced there must be ways to simplify it (& make error checking easier i.e. OP)

    The real sheet looks like this... thank goodness there's a size limit on here

    yIJXftEiTXa5YB2YQVsLEg.png
    Last edited by Median; 04-15-2018 at 04:34 PM.

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining a formula creates different result

    Well, simply taking the formula from KT and combining it into KU (looks like 8 references in KU to KT) is not going to make it better.
    If anything, it would make it worse.

    it looks like JohnTopley is onto something, I'd go in that direction.
    I'd agree with John that the relationship of KS1 and KV1 is not clear.

  12. #12
    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,192

    Re: Combing a formula creates different result

    For KU3 you get 153 I get 151: why the difference? All the others agree (KU2:KU7)

    Logging off now!

  13. #13
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combining a formula creates different result

    It's might be worth having a read of this thread - although the values are different the concept is identical - & the long formula is a result of everything in this thread (https://www.excelforum.com/excel-for...formula-2.html)

    However the key post - is this one by Flame (post #18). Hopefully that clears up what KS1 & KV1's job is (i.e. they define the calculation range)

    The reason you're getting 152 is explained, hopefully, in post #24. Those tables are basically the inner workings of the long formula (lots of IF's & checks)

    If you need further clarification - ask away
    Last edited by Median; 04-15-2018 at 06:22 PM.

  14. #14
    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,192

    Re: Combining a formula creates different result

    See post #9 !!!!

  15. #15
    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,192

    Re: Combining a formula creates different result

    Curiosity getting the better of me:

    Do your ranges always go from 1 to n? If so, how variable is n (KS1)? Examples have been 100 and 300 only.

    And what is logic on MATCH vs KT2:

    Equal : OK

    Less than/greater than i.e no exact match ???

    Out of range: blank

  16. #16
    Forum Contributor
    Join Date
    01-26-2018
    Location
    London, England
    MS-Off Ver
    365
    Posts
    311

    Re: Combining a formula creates different result

    Not necessarily; for example:

    fwZM_vaJQceKMDr5j58SrA.png

    It needs to find the first number less than KT2. If it finds this number (Match1)(within the dynamic range), it then tries to finds the first value equal to KT2 (Match0). If Match 0 occurs first, this is the value which gets displayed

    (the most important aspect of the formula is detecting "bound breaks")
    Last edited by Median; 04-16-2018 at 09:17 AM.

  17. #17
    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,192

    Re: Combining a formula creates different result

    Curiosity satisfied!!!

+ 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. Replies: 2
    Last Post: 03-19-2018, 09:16 PM
  2. [SOLVED] Need Help on a combing formula
    By alcorp in forum Excel General
    Replies: 3
    Last Post: 07-24-2014, 12:55 PM
  3. Userform textbox value with formula creates a result in excel
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2013, 05:21 PM
  4. [SOLVED] Combing a V Lookup result with ("00"&A2)*1 in same formula
    By jtfranco in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-01-2013, 01:21 PM
  5. [SOLVED] vlookup with a lookup value that contains a formula (creates an #N/A result)
    By tlapointe1970 in forum Excel General
    Replies: 3
    Last Post: 10-09-2012, 01:36 PM
  6. [SOLVED] Formula Help Combing two AND statements
    By Yogi_Bear_79 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  7. Formula Help Combing two AND statements
    By Yogi_Bear_79 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2005, 12:05 AM

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