+ Reply to Thread
Results 1 to 6 of 6

If Countif and Substitute combined - adding another value into if function

  1. #1
    Forum Contributor
    Join Date
    08-25-2015
    Location
    London
    MS-Off Ver
    MS 365
    Posts
    213

    Question If Countif and Substitute combined - adding another value into if function

    Hi everyone,

    I'm currently working on a spreadsheet that copies content from one worksheet to another whilst replacing dynamic strings with specific content based on a locale.

    The formula that is working so far is:

    Please Login or Register  to view this content.
    However, now I have a 3rd criteria "*Asia*" to include into the if function for which the "[Rew]" should be replaced with "LoyaltyAsia" when copying over. I tried to change this to be an IFS formula, but just can't get it to work :-(

    Hope someone can help?
    Many thanks!
    Last edited by kingofcamden; 09-26-2018 at 05:02 AM. Reason: Solved.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: If Countif and Substitute combined - adding another value into if function

    IFS is available only if you have Excel 2016 and a subscription to Office 365. Your profile shows you are using Excel 2010, so you can't use IFS.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: If Countif and Substitute combined - adding another value into if function

    It's difficult to work without a small representative sample of your data along with the desired results but I'll give it a try based on what you have shared.

    Try this:

    =SUBSTITUTE(LOCFile!C2,"[Rew]",IF(SUM(COUNTIF($A2,{"*LATA*","*_es*","*Eses*","*LATAM*"})),"Loyalty",IF(COUNTIF($A2,"*Asia*"),"LoyaltyAsia","Loyalty123")))

    or a little shorter:

    ="Loyalty"&SUBSTITUTE(LOCFile!C2,"[Rew]",IF(SUM(COUNTIF($A2,{"*LATA*","*_es*","*Eses*","*LATAM*"})),"",IF(COUNTIF($A2,"*Asia*"),"Asia","123")))
    Last edited by 63falcondude; 09-25-2018 at 01:56 PM. Reason: Added second formula

  4. #4
    Forum Contributor
    Join Date
    08-25-2015
    Location
    London
    MS-Off Ver
    MS 365
    Posts
    213

    Re: If Countif and Substitute combined - adding another value into if function

    Hi 6StringJazzer & 63falcondude,

    Thanks so much for your comments and help! I'm working with Excel 2016 (sorry, should've updated that in my profile!), however, the formula 63falcondude suggested works great!:

    Please Login or Register  to view this content.
    Only thing is that I realised there is another IF clause I need to build in (annoyingly!). I tried the following, but it doesn't seem to work ("too many arguments for this function") - any chance you could have a look please?

    Please Login or Register  to view this content.
    Appreciate your help!

  5. #5
    Forum Contributor
    Join Date
    08-25-2015
    Location
    London
    MS-Off Ver
    MS 365
    Posts
    213

    Re: If Countif and Substitute combined - adding another value into if function

    Ahh, false alarm! Managed to get it to work. Forgot to include {}

    Thanks for your help!

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: If Countif and Substitute combined - adding another value into if function

    You're welcome. Happy to help.

+ 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. Adding a COUNTIF function to an existing IF AND COUNTIF Formula...
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2018, 10:09 AM
  2. [SOLVED] Adding an AND Function to a =IF(COUNTIF.... Formula
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-30-2017, 11:51 AM
  3. [SOLVED] CountIf function ... adding another variable
    By Busjedwa30 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-01-2015, 07:48 AM
  4. [SOLVED] Sumif And countif combined function
    By Deventus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2013, 05:11 AM
  5. Adding a countIf function into column B if A has data
    By synergio in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2012, 11:13 AM
  6. [SOLVED] Countif function combined with conditional formatting
    By molson1973 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-30-2012, 07:13 PM
  7. can Substitute formulas be combined?
    By go3go3go in forum Excel General
    Replies: 2
    Last Post: 02-28-2007, 06:24 AM

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