+ Reply to Thread
Results 1 to 5 of 5

Replace IF THEN ELSEIF statement with INDIRECT function?

  1. #1
    Registered User
    Join Date
    10-09-2016
    Location
    los angeles
    MS-Off Ver
    2016
    Posts
    7

    Replace IF THEN ELSEIF statement with INDIRECT function?

    Its ugly but Module 2 does work and this is what I was able to muster with my skill. I would like to learn to use variables to rewrite this in an efficient way. I've been trying to use the INDIRECT function to vary the values in the Invoice sheet, cells A19 to A37, as those values are the corresponding worksheet names, didn't get anywhere (don't know if that even works). Thank you very much for your time. Always learning alot here.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Replace IF THEN ELSEIF statement with INDIRECT function?

    Would you manually add the results you expect to see for a couple of MFRs.

    Have you considered keeping all your data on single sheet in a single table using exactly the same column layout but with an extra column to identify the MFR.
    Having a pukka database simplifies any subsequent analysis you may need.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-09-2016
    Location
    los angeles
    MS-Off Ver
    2016
    Posts
    7

    Re: Replace IF THEN ELSEIF statement with INDIRECT function?

    I don't follow what you meant my "manually add the results you expect to see for a couple of MFRs". Yes, I did consider keeping everything in a same table but that list will be humongous later on. I broke it down by MFR for ease of accessibility. Also, I don't know what a pukka is other than a character figure. Thanks for your quick reply.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Replace IF THEN ELSEIF statement with INDIRECT function?

    I meant on the Invoice sheet pick a couple of MFRs in A19 & A20 then manually add the result you expect to see in B19:F20 after your macro has run.
    I don't know what you expect to see since the Update Inventory button doesn't appear to do anything.

    Sorry, by 'pukka' I meant proper/real/genuine. It's British slang for an Indian word originating from our colonial days in India.

    Keeping data all on one sheet doesn't occupy any more space than spreading it across several sheets. There's no reason given the rich data filtering functionality that would mean data is hard to find, and believe me with such a database analysis is simplified considerably.
    Last edited by Richard Buttrey; 11-02-2016 at 08:05 PM.

  5. #5
    Registered User
    Join Date
    10-09-2016
    Location
    los angeles
    MS-Off Ver
    2016
    Posts
    7

    Re: Replace IF THEN ELSEIF statement with INDIRECT function?

    Richard,
    I did consolidate all the pricing info and it did simplify the macro.
    Thanks.

+ 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] Replace INDIRECT with more elegant function
    By froment in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-26-2020, 12:10 AM
  2. Adding CountIf Statement within If/ElseIf Statement
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 05:09 AM
  3. [SOLVED] If...Then...ElseIf statement
    By BrownBoy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2014, 05:19 PM
  4. Code stepping in to elseif statement when elseif is definitely not true
    By DFrank231 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2013, 05:31 PM
  5. If then elseif statement
    By Mac10 in forum Excel General
    Replies: 3
    Last Post: 10-02-2010, 09:29 PM
  6. Trying to replace INDIRECT with INDEX or another function
    By deadlyduck in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2009, 12:51 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