+ Reply to Thread
Results 1 to 12 of 12

IF Statement that will assign account types based on "account number"

  1. #1
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    IF Statement that will assign account types based on "account number"

    In excel I have financial data that has "account number" (ex. 1000, 1001, etc) in column 1, "account description" (cash, a/r) in column 2 and the account balance (8,794) in column 3.

    Basically I want to know how I can construct an IF statement in VBA that says IF the value in column 1 is greater than 1000 but less than 1005 THEN assign it a value of "cash" in column 4 for all of the account numbers within this range.

    Any input would be greatly appreciated!

    attached is the project and also how I need the spreadsheet to look like
    IDS 331 Project (2).xlsm

    http://i.imgur.com/zM1vhE9.png

  2. #2
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: IF Statement that will assign account types based on "account number"

    Cory,

    Thanks for the if statement. If i needed to continue this with the next sequence of account numbers (1006-1010) would I just repeat the IF statement using those values??

    Can you show me an example of this?

    Thanks again!

  4. #4
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    IDS 331 Project (2).xlsm

    This way will work but can be cleaned up quite a bit once you look at it you can figure out how to make it look better and make an easier way of it to work.

    Note that the macro is named InputcolD... and look at each of the if statements and you will see how the account numbers and stuff is setup you can change them accordingly...

  5. #5
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: IF Statement that will assign account types based on "account number"

    Cory, you are a genius!!

    Thanks so much man.

    Wondering if I can pick your brain about one more thing. After running this macro and assigning the proper "account types" to each of the accounts, do you think it is feasible to use a SUM + Vlookup function to populate the balance sheet data on the Balance Sheet tab?

    I have a user defined function in there now but its not working as desired (it requires me to input each account number separated by a comma as a delimeter)

    Thanks again for your input!

  6. #6
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    I need you to explain more on what data needs to be populated and where... are you wanting to do this in vba or somewhere else??? I need a better explanation as I look at your workbook.

    ... I am not sure about vlookup sum but yes it is possible in vba I will do the same thing but you will need to edit the account numbers in the code to make them correct.
    Last edited by cory0789; 12-07-2014 at 11:20 PM.

  7. #7
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: IF Statement that will assign account types based on "account number"

    Basically, I need the "Balance Sheet" tab in the workbook populated by the data in the "Data" tab. For example, in the "Balance Sheet" tab, there is a line called "Cash", I need all of the account balances labeled "Cash" that we accomplished by the IF statement to be summed onto 1 line onto the "Balance Sheet" labeled Cash. I was hoping to accomplish this using the Sum +Vlookup function in each of the "Balance Sheet" lines. Any idea on if this is the right approach or another way you would do this?

  8. #8
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: IF Statement that will assign account types based on "account number"

    If you want take a look at my user defined function in Module 3, not sure if i was on the right track there but that proved to be incorrect cause I had to input each of the account numbers to get it to sum the values which is not flexible enough

  9. #9
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    IDS 331 Project (2).xlsm


    look at the macro balance sheet and you can edit it how you need it to work but it should do what you are wanting... if not let me know
    Last edited by cory0789; 12-08-2014 at 12:09 AM.

  10. #10
    Registered User
    Join Date
    12-07-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: IF Statement that will assign account types based on "account number"

    Cory this is great stuff!

    One last question, if I wanted to add the Liability accounts (ex. Payables, long term debt) should I just add those within the IF statement in the BalanceSheet Macro? Also I will need to add them as variables too correct?

    Any tips on how to do this?

    Thanks again, i really appreciate it!

  11. #11
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    Yes just add it the way cash is but put lisbilities or whatever else you need... Copy one of the starenents that is already there

  12. #12
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: IF Statement that will assign account types based on "account number"

    Did you get it the way you wanted?

+ 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 program to account for all choices "ABC*", "*ABC", "*ABC*"
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-20-2014, 03:24 PM
  2. Managing "delegated tasks" in an Outlook "Send Only" account
    By on_way_to_fame in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 08-13-2013, 12:21 AM
  3. Return Account Nickname if Account Number Matches
    By spacle in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-03-2013, 11:04 AM
  4. [SOLVED] How to censor account numbers based on how many characters are in the account number
    By Mcorydon in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-25-2013, 01:06 PM
  5. Replies: 1
    Last Post: 09-07-2012, 12:00 PM

Tags for this Thread

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