+ Reply to Thread
Results 1 to 13 of 13

If cell contains this text, then perform formula from a different cell

  1. #1
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    If cell contains this text, then perform formula from a different cell

    Hey guys! I'm trying to study some email analytics for the company I work for, and I want to compare days of the week. So I want to do a "If a cell in this column contains "Sunday", then include this specific cell next to it in this function." Does that make sense? Is that possible?

    For example, the columns are currently organized by:
    Title (A1), Date (B1), # sent (C1), # opened (D1), and more of miscellaneous data.
    So I want to do something like if a cell in the B column contains "Sunday", say B12, B16, and B32, then I want to include c12, c16, and b32 in an average function.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: If cell contains this text, then perform formula from a different cell

    Try this:

    =AVERAGEIF(B2:B100,"Sunday",C2:C100)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Re: If cell contains this text, then perform formula from a different cell

    Thanks for your quick reply! Unfortunately it didn't work, I had a divide by 0 error.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: If cell contains this text, then perform formula from a different cell

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  5. #5
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Re: If cell contains this text, then perform formula from a different cell

    Sure! Here's a sample of it. If I built something wrong inside this sample I wouldn't be surprised - I'm no expert - so let me know if I need to fix anything else, too! I'll attached a desired result soon.
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: If cell contains this text, then perform formula from a different cell

    The formula you need is:

    =AVERAGE(IF(WEEKDAY($B$3:$B$23)=1,$D$3:$D$23))

    However, it still returns an error message as there are NO Sundays in that date range.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: If cell contains this text, then perform formula from a different cell

    Oooops. Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

  8. #8
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Re: If cell contains this text, then perform formula from a different cell

    Here is the same sheet, but with the example of the desired result below. My actual sheet has hundreds of rows - so if I can avoid manually doing it like this that would be fabulous.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Re: If cell contains this text, then perform formula from a different cell

    I think that worked for Sunday, but how do I change the day of the week? I tried switching the 1 after the weekday, thinking maybe Sunday was 1 and Monday might be 2, but that didn't work. Or is "Weekday" where I type the day of the week I'm looking for?

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: If cell contains this text, then perform formula from a different cell

    Enter array formula in C27 and copy across and down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    **Must be entered with Ctrl+Shift+Enter key combination.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  11. #11
    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
    28,209

    Re: If cell contains this text, then perform formula from a different cell

    In C27

    =IFERROR(AVERAGE(IF(WEEKDAY($B$3:$B$23)=ROWS($1:1),$C$3:$C$23)),"")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Copy down

    the ROWS($1:1) will increment so match (Weekday(....)=1, then 2 etc

  12. #12
    Registered User
    Join Date
    04-12-2017
    Location
    Lincoln, NE
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Re: If cell contains this text, then perform formula from a different cell

    Ah ha! I believe you have solved it! Thank you so much for your help!

  13. #13
    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
    28,209

    Re: If cell contains this text, then perform formula from a different cell

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. How to Ignore Text and Perform Calculation in Single Cell?
    By FLFisherman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-04-2015, 02:03 PM
  2. Replies: 6
    Last Post: 08-28-2013, 10:50 PM
  3. [SOLVED] Only perform formula if another cell is non-blank
    By stevejfice in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2012, 10:47 AM
  4. how to prevent users able to perform cell actions except cell range selection
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2010, 09:47 AM
  5. Perform a vlookup on a cell containing a formula?
    By Rupea22 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2010, 12:11 PM
  6. Can a cell contain text and perform calculation?
    By drewship in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-18-2009, 02:43 PM
  7. Replies: 11
    Last Post: 02-18-2009, 10:49 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