+ Reply to Thread
Results 1 to 18 of 18

Code throwing error to formula in sheet while converting rel to abs

  1. #1
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Code throwing error to formula in sheet while converting rel to abs

    Hi All,
    Below is the formula.

    +IF(SUM(W37:W38)<>0,0,IF('account_type_transactions (2)'!O584=0,SUM('account_type_transactions (2)'!O584:O585),IF('account_type_transactions (2)'!O584=1,SUM('account_type_transactions (2)'!Q584:Q585),IF('account_type_transactions (2)'!O584>2000,SUM('account_type_transactions (2)'!Q590:Q591)))))

    In this formula, when i try to do
    Please Login or Register  to view this content.
    It is throwing #value error...
    Why is it so?
    for nested loop this is throwing..

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code throwing error to formula in sheet while converting rel to abs

    There's a 255 character limit to the length of the formula you convert using ConverFormula.

    Mind you, it's not clear how you are trying to convert the formula - all the references in it are relative as it is.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Norie,
    In this case , then how i need to do.
    I want the references to change into absolute ref in the formula.
    I have around 10000 lines of different nested if formulas, i want make the reference to be absolute ref..

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code throwing error to formula in sheet while converting rel to abs

    If you want to change the references in the formulas to absolute for both row and column then use 1 instead of 4.

    To get over the character limit you could either temporarily change the name of the sheet referenced in the formula to a shorter name, do the conversion and change the name back.

    Or you could use code to temporarily replace the sheet name in the formula, do the conversion and then restore the sheet name.

    The former is probably the easiest way to do it.

  5. #5
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi ,
    I changed but still it turns into #value..
    Any custom function to turnaround this... or how to temporarily change? i am not getting it? Can you provide the eg in the above one..

  6. #6
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Norie,
    The total formula is this..


    IF(SUM(X2252:CF2252)=0,0,IF(CJ2263=0,'account_type_transactions (2)'!D18,IF(CJ2263=1,SUM('account_type_transactions (2)'!D18:E18),IF(CJ2263=2,SUM('account_type_transactions (2)'!D18:F18),IF(CJ2263=3,SUM('account_type_transactions (2)'!D18:G18),IF(CJ2263=4,SUM('account_type_transactions (2)'!D18:H18),IF(CJ2263=5,SUM('account_type_transactions (2)'!D18:I18),IF(CJ2263=6,SUM('account_type_transactions (2)'!D18:J18))))))*EW2263)))

  7. #7
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    And i tried putting dummy sheet names for this above code.. The character came around 70, but still i got #value.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code throwing error to formula in sheet while converting rel to abs

    You could probably shorten that formula quite a bit.

    =IF(SUM(X2252:CF2252)=0,0,OFFSET('account_type_transactions (2)'!D18,0,0, CJ2263+1)*EW2263)

  9. #9
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Norie,
    Thanks..
    this is useful, but for me to change whole workbook with different ranges, it is tedious..
    Can there be any alternative custom function to application.convert formula.. and the character limit is only for the sheet names right not for the formula? or this will also be included?

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code throwing error to formula in sheet while converting rel to abs

    The character limit is for the total no of characters in the formula.

    If you had a shorter sheet name in the formula, the current one has 29 characters and is repeated 7 times in the formula which is 203 characters, then the code might work.

  11. #11
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Yes, but in other sheets, i have 10 characters and is repeated same 7 times. but also it throws error? Thats y i asked
    Last edited by dorabajji; 10-09-2019 at 09:11 AM.

  12. #12
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Norie,
    That dummy sheet and the formula is below
    =+IF(SUM(Y38:Y39)<>0,0,IF(sf!Q585=0,SUM(sf!Q585:Q586),IF(sf!Q585=1,SUM(sf!S585:S586),IF(sf!Q585>2000,SUM(sf!S591:S592)))))

    For this also i got #value..

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,257

    Re: Code throwing error to formula in sheet while converting rel to abs

    Convertformula will translate references to other sheets as external references and add the workbook name. If that returned formula ends up longer than the 255 characters, you get an error.
    Remember what the dormouse said
    Feed your head

  14. #14
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi,
    Yes,but i am looking for a turnaround way..
    i tried as norie suggested to change the name.. but also it showed error..
    I tried to do with split function.. in that i am facing issue with respect to cell reference..
    For eg: the function works fine, if the cell ref are same..
    In the above formula for sf sheet i get Q585..
    if it changes QR5850 like this , then i am not able to..

    I want to know, in the above formula , how to extract cell address in the formula..

    the formula is

    =+IF(SUM(Y38:Y39)<>0,0,IF(sf!Q585=0,SUM(sf!Q585:Q586),IF(sf!Q585=1,SUM(sf!S585:S586),IF(sf!Q585>2000,SUM(sf!S591:S592)))))

    I want to extract Q585 from the formula,
    So that i know how many letters and numbers, accordingly i can use left to add abs ref..
    Last edited by dorabajji; 10-09-2019 at 11:55 AM.

  15. #15
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Rorya sir,
    then also it comes to testingg is my name workbook name..
    So if it repeats 10 times it comes to 80 and +70...
    Comes to 150? within 255 only no..

  16. #16
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    I tried splitting the formula in to array strings then applying convert formula.. but this also had error..
    as split was done using "," and i think it didnot complete a formula..
    Please Login or Register  to view this content.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code throwing error to formula in sheet while converting rel to abs

    This is really rough but might work.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Code throwing error to formula in sheet while converting rel to abs

    Hi Norie,
    Is it possible to use array in the above as i have a range.. I have modified the above into range, but still i have more than 500 rows, so it is slow..I am not too familiar with 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. [SOLVED] Code to add sheets throwing Syntax error
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-02-2019, 02:44 PM
  2. [SOLVED] Mac throwing error - Runtime Error 429 - ActiveX Component Can't Create Object
    By harman83 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-28-2018, 11:04 PM
  3. [SOLVED] Ifs formula throwing error #Name?
    By Neilesh Kumar in forum Excel General
    Replies: 17
    Last Post: 11-20-2017, 09:52 AM
  4. Code Throwing Run Time error...
    By tsiguy96 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2016, 03:59 PM
  5. [SOLVED] VBA code throwing error
    By philozelda in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2015, 02:35 PM
  6. [SOLVED] This Code Is Throwing An Error At The End...
    By Regular_Joe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2014, 11:15 AM
  7. Formula Array not working and throwing up error
    By drgogo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2010, 06:56 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