+ Reply to Thread
Results 1 to 4 of 4

VBA Code for non easy IF Formula

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    Israel
    MS-Off Ver
    Excel 2019
    Posts
    79

    VBA Code for non easy IF Formula

    Hay

    I hope that you will understand my problem

    I have a IF formula that check if “F13” cell is "+" if not do calculation (F13-E13) and stop, if yes go to the previous line and check if the “F12” is "+" if not do calculation (F12-E12) and stop, if yes continuo to the previous cell and so on until you find cell without “+”

    The EXCEL IF formula is
    =IF(F13="+",IF(F12="+",IF(F11="+",IF(F10="+",IF(F9="+",IF(F8="+",E8-F8),F9-E9),F10-E10),F11-E11),F12-E12),F13-E13)

    I'm looking for VBA code with FOR to run and do the same without the limitation of 7 if inside if.

    Thanks in advanced
    Shark Man
    Last edited by Shark Man; 04-17-2009 at 03:48 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: VBA Code for non easy IF Formula

    Maybe

    May need to change the offset for the result cell as currently set for Col F

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    04-15-2009
    Location
    Israel
    MS-Off Ver
    Excel 2019
    Posts
    79

    Re: VBA Code for non easy IF Formula

    Thanks for your quick reply

    I need that the 13 and 8 at the example will be dynamic.

    I need to run on a sheet with more than 40,000 records

    The maximum interval between "+" and number don’t pass 10 rows

    Thanks

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: VBA Code for non easy IF Formula

    I need that the 13 and 8 at the example will be dynamic.
    You could find the lastcell in Col F (Change to what ever column has you're last data)

    Please Login or Register  to view this content.
    I assume you could set the first cell as 1?

    The maximum interval between "+" and number don’t pass 10 rows
    Don't understand why you've mentioned this?

    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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