+ Reply to Thread
Results 1 to 5 of 5

If - Then - Else ?

  1. #1
    Registered User
    Join Date
    07-27-2010
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2003
    Posts
    5

    If - Then - Else ?

    I took an Access class years ago, but I have no idea how to program Excel.

    I was hoping someone could tell me how to program an excel spreadsheet I am working on.


    I have a column in which I enter either credit card or cash (i). And another column which has the amount paid (L). I would like to seperate the amounts into 2 additional columns depending on which kind of payment was used.

    Something like, if -i- says "cash" then take -L- and put it in -N-, else -M-.

    Is this possible in excel ?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If - Then - Else ?

    Assuming the data starts at row2, titles in row1, then try this:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: If - Then - Else ?

    Unless you are specifically after a VBA macro, you can also do this simply with formulas.

    Something like, if -i- says "cash" then take -L- and put it in -N-, else -M-.

    in N2 and copied down
    =if(i2="cash", L2, "")

    In M2 and copied down
    =if(i2="cash", "", L2)
    Last edited by shg; 07-28-2010 at 12:17 AM.

  4. #4
    Registered User
    Join Date
    07-27-2010
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: If - Then - Else ?

    Teylyn,


    Thank You ! It worked perfectly.



    JBeau,

    I appreciate the effort, but that was waaaay ahead of my capabilities as of yet.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If - Then - Else ?

    No problem. Posting in the Programming forum instead of General forums and then asking what sounds like a programming question mislead us to think you're seeking a programming solution.

    The worksheet formula approach is always more preferable to VBA when it's available, in my opinion. Hat-tip to Tey.

    ========
    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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