+ Reply to Thread
Results 1 to 7 of 7

If and using part of string.

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    England
    MS-Off Ver
    2016 (Mac)
    Posts
    149

    Cool If and using part of string.

    I am trying to combine two formulas but with no luck! I want to check if part of a cell string is equal to "march" and if it is then I want to check if another cell string is equal to "booking" if this condition is met then I want do display the contents of another cell.

    So for example cell A1 has the string "2nd March 2015" and cell A2 has the string "booking" the condition is met and I therefore want to display the value of A3.

    I tried something like this but it did not work:

    =IF(AND(ISNUMBER(SEARCH("mar",A1)),A2="booking",A3,""))

    Tried every way I can think of but cannot get it to work the way I want it to...

    Thank you in advance for any help

  2. #2
    Valued Forum Contributor
    Join Date
    02-07-2013
    Location
    Philippines
    MS-Off Ver
    Excel Online; 365
    Posts
    633

    Re: If and using part of string.

    Try this:

    =IF(AND(COUNTIF(A1,"*march*")>0,COUNTIF(A2,"*booking*")>0),A3,"")
    If I've helped U pls click on d *Add Reputation

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,861

    Re: If and using part of string.

    Missing ")"

    =IF(AND(ISNUMBER(SEARCH("mar",A1)),A2="booking"),A3,"")

  4. #4
    Forum Contributor
    Join Date
    01-18-2013
    Location
    England
    MS-Off Ver
    2016 (Mac)
    Posts
    149

    Re: If and using part of string.

    Works a treat. I think that I can further customize this formula so that it is better for my needs. I am trying to search the columns so that if march is anywhere in column A and booking in anywhere in column B then the total of column C will be added up. So A1="march" A2="booking" A3=10, A1 and A2 meet the condition and therefore the value is 10. I need to do this for the whole column though from 1-100. I tried to add a VLOOKUP as I think this is the way to go but I am not very good at formulas! Below is another version I tried but it did not give me the correct value?

    =IF(AND(COUNTIF(C21:C24,"*march*")>0,COUNTIF(D21:D24,"*booking*")>0),E21:E24,"")


    Is there a way to add VLOOK up into these conditions?

    Thank you for your help

  5. #5
    Valued Forum Contributor
    Join Date
    02-07-2013
    Location
    Philippines
    MS-Off Ver
    Excel Online; 365
    Posts
    633

    Re: If and using part of string.

    if that's the case then you're better off using this:

    =SUMIFS(C:C,A:A,"*march*",B:B,"*booking*")
    Last edited by bhenlee; 07-27-2015 at 04:10 PM.

  6. #6
    Forum Contributor
    Join Date
    01-18-2013
    Location
    England
    MS-Off Ver
    2016 (Mac)
    Posts
    149

    Re: If and using part of string.

    WOW,
    Thank you so much. My formulas were just getting longer and longer and still not working! VLOOKUP, if this if that....lol

    I will keep this formula in my best formulas as it's a great one to keep.

    Much appreciated

  7. #7
    Valued Forum Contributor
    Join Date
    02-07-2013
    Location
    Philippines
    MS-Off Ver
    Excel Online; 365
    Posts
    633

    Re: If and using part of string.

    glad it work!!!

    if you're satisfied with the answer please mark this thread as Solved and consider adding a rep to those who've helped.

    Regards

+ 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. Replies: 2
    Last Post: 03-18-2015, 07:30 PM
  2. [SOLVED] How Do I Find and Return a String When Only Part of that String is Known?
    By Foamy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-08-2014, 05:31 AM
  3. [SOLVED] Can I remove the first part of a string of text and keep the second part?
    By Whoop92 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 02-12-2014, 07:44 PM
  4. [SOLVED] Find a string by VBA Regular Expression and replace a part of that string
    By taps in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2013, 11:08 AM
  5. Looking for Part of a String
    By arussell1983 in forum Excel General
    Replies: 6
    Last Post: 02-06-2010, 09:17 PM
  6. [SOLVED] part of string
    By RobcPettit@yahoo.co.uk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2005, 08:25 AM
  7. Use part of string
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2005, 07:05 AM

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