+ Reply to Thread
Results 1 to 9 of 9

Excel IF Function

  1. #1
    Registered User
    Join Date
    06-02-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Excel IF Function

    Hi guys, first post here!

    I used Excel at school but more so Access, but anyway. What I'm trying to do is make use of the IF statement.

    For instance, as an example I have colours in column A, and prices in column B. If the colour is Red, how do I add £1 to the price in column B.

    We would have to do this on files with 1000's of records in so it is possible to do this in a macro as well?

    So to summarize. If the colour of the item is red the price gets increased by £1. If it's not red, i.e. any other colour in the column the price stays the same.

    Cheers!

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Excel IF Function

    In C1 tyry =If (a1="red",b1+1,b1) and pull down as needed

  3. #3
    Registered User
    Join Date
    06-02-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel IF Function

    Arthur, that's great!

    It works a charm.

    One more thing, could you just explain the areas of the formula so I can build from this. I understand the a1="red" and the b1+1 but ain't so sure on the final b1 and what it means.

    Cheers.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Excel IF Function

    The final B1 replaces the empty cell with the unchanged price. If you do not want it replace it with "" in the formula
    BTW to extend the formula fast, select the cell with the formula and double click the handle at the lower right corner. it should extend down as long as there is something in the cell left or right to it

  5. #5
    Registered User
    Join Date
    06-02-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel IF Function

    Great thanks!

    Can I put this into a Macro and run it or is it not beneficial to do this?

    Cheers

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Excel IF Function

    It's of course possible, but why do you need a macro when you already have formulas?

  7. #7
    Registered User
    Join Date
    06-02-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel IF Function

    Yeah good point.

    OK, I've got another one for you! I have cells with SKU's that have various data in but a large batch end with "ss" so for example the SKU column contains 4000 cells, 1000 of which are like this:

    productnamess
    productothernamess
    adifferentproductnamess

    Is it possible to select these columns using the fact that they end in "ss" as an identifier and adding £2 to those. I'm guessing the theory is the same as the previous forumla just with an adjustment to the start of the formula.

    To summarise, I have variable data but many that END with "ss". It's these fields I wish to pick out and add £2, much in the same way you showed me in the previous formula which works great!

    Cheers

  8. #8
    Registered User
    Join Date
    06-02-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel IF Function

    Any thoughts on this one?

  9. #9
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Excel IF Function

    Yep try =if(right(a1,2)="ss", b1+2,b1)

+ 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