Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Excel if Formula

  • 14-05-2019 04:26PM
    #1
    Registered Users, Registered Users 2 Posts: 1,511 ✭✭✭


    Hi can somebody advise please or provide a link to some instructions, thanks.

    I would like to add a formula to a column where by if a given cells (product) code begins with 1 or 2 a corresponding cell will show a certain text depending on which.

    i would also like to account for times where by the formulated column may be blank or contain a different value and so the corresponding cell should then remain to be manually filled.


Comments

  • Registered Users, Registered Users 2, Paid Member Posts: 1,711 ✭✭✭JoyPad


    Have a look here: https://support.office.com/en-ie/article/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb

    For the first scenario, you probably need LEFT to extract the start of the product code.

    e.g. IF( LEFT(A2, 1) = "1", "One", "Not One" )
    If the first character in the A2 cell is "1", then value of this cell will be "One", otherwise it will be "Not One".

    To check if a cell is empty, use ISBLANK.

    I subscribed to keep boards.ie alive!
    boards.ie: Now Ye're Subscribing



  • Registered Users, Registered Users 2 Posts: 4,423 ✭✭✭smuggler.ie


    This should cover other values in the cells, paste in top cell and drag it down.
    in B1: =IF(LEFT(A1,1)="1","Text1",(IF(LEFT(A1,1)="2","Text2","other or empty")))

    return count of code "1????" in D13: =COUNTIF(B1:B10,"Text1")

    return count of code "2????" in D14: =COUNTIF(B1:B10,"Text2")

    return count of code "any other value" in D15: =COUNTIF(B1:B10,"other or empty")


    480278.JPG


  • Registered Users, Registered Users 2 Posts: 1,511 ✭✭✭Old Perry


    Thanks for the above. I will experiment and be back with more questions surely.


  • Registered Users, Registered Users 2 Posts: 4,423 ✭✭✭smuggler.ie


    Or, instead counting "text" values, you could count actual codes starting with "1", etc.


    =SUMPRODUCT(--(LEFT($A$1:$A$10,1)="1"))


Advertisement