+ Reply to Thread
Results 1 to 8 of 8

HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in them

  1. #1
    Registered User
    Join Date
    06-23-2018
    Location
    Romania
    MS-Off Ver
    2019 beta
    Posts
    8

    HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in them

    Hi,

    Could you please help me finding excel formulas for the following problem?

    I have the following cells on the same column (column A, rows 1-5):

    A
    1 00:30 random1 !day random6
    2 01:00 random2 !day
    3 02:00 random3 !night
    4 01:15 random4 !night random7
    5 00:15 random5 !day

    Basically all cells contain: an hour (always at the beginning of the cell), random words, a key word (that starts with !)

    First for !day

    Could you help me SUM all the hours in the cells that have the keyword !day in it in one formula? (without splitting the cell data in multiple cells) Should be 01:45
    Could you help me AVERAGE all the hours in the cells that have the keyword !day in it in one formula? (without splitting the cell data in multiple cells) Should be 00:35
    Could you help me MIN all the hours in the cells that have the keyword !day in it in one formula? (without splitting the cell data in multiple cells) Should be 00:15
    Could you help me MAX all the hours in the cells that have the keyword !day in it in one formula? (without splitting the cell data in multiple cells) Should be 01:00

    also do the same for !night

    Could you help me SUM all the hours in the cells that have the keyword !night in it in one formula? (without splitting the cell data in multiple cells) Should be 03:15
    Could you help me AVERAGE all the hours in the cells that have the keyword !night in it in one formula? (without splitting the cell data in multiple cells) Should be 01:37
    Could you help me MIN all the hours in the cells that have the keyword !night in it in one formula? (without splitting the cell data in multiple cells) Should be 01:15
    Could you help me MAX all the hours in the cells that have the keyword !night in it in one formula? (without splitting the cell data in multiple cells) Should be 02:00

    Thank you very much!
    Last edited by mathkkad; 06-23-2018 at 09:49 AM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: HELP! Finding an appropriate formula

    Try a user defined formula like this.

    Please Login or Register  to view this content.
    Open the VBA editor by hitting Alt F11.
    Insert a new module with Insert - Module
    Paste in the above function
    Go back to the sheet by hitting Alt F11.

    In a suitable cell, enter =SumSpecial(A1:A5,"!day")

    Remember to save the workbook as a macro enabled workbook .xlsm
    Martin

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: HELP! Finding an appropriate formula

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title
    Quang PT

  4. #4
    Registered User
    Join Date
    06-23-2018
    Location
    Romania
    MS-Off Ver
    2019 beta
    Posts
    8

    Re: HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in

    Thank you for your reply, alt+f11 does nothing for me, tried in 2x versions of excel

    Also i would prefer a solution that just uses formulas like sumifs; averageifs; maxifs; minifs; and so on

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,916

    Re: HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in

    Try this:

    =SUM(IF(RIGHT($A$1:$A$5,3)="day",--LEFT($A$1:$A$5,5)))

    Array formula, enter with Ctrl+Shift+Enter.

  6. #6
    Registered User
    Join Date
    06-23-2018
    Location
    Romania
    MS-Off Ver
    2019 beta
    Posts
    8

    Re: HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in

    Thank you for the formula Phuocam, it works very well.

    Do you think you could change the RIGHT($A$1:$A$5,3)="day" to a improved "search the cell for the exact word matching - making its position arbitrary" as not all keywords at the end of the cell have the same size and sometimes the keyword is not the final word of the cell. (I could also use a separate cell like B1 for the "day" keyword and i can make a reference to that for a search) - i have modified my first post accordingly
    Plus in reality i have a lot of cells that i have to manually modify if i have to manually adjust the keyword and the number of ending letters for the RIGHT formula.

    Do you think it is a better way to put that part of the formula? As the rest works very well. Thank you again
    Last edited by mathkkad; 06-23-2018 at 09:35 AM.

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,916

    Re: HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in

    Change the formula to:

    =SUM(IF(ISNUMBER(SEARCH(B1,$A$1:$A$5)),--LEFT($A$1:$A$5,5)))

    Array formula, enter with Ctrl+Shift+Enter.

  8. #8
    Registered User
    Join Date
    06-23-2018
    Location
    Romania
    MS-Off Ver
    2019 beta
    Posts
    8

    Re: HELP! Finding SUM, AVERAGE, MIN, MAX formulas for cells that have numbers and text in

    Thank you so so much for the help, Phuocam. It works perfeclty. Have a great day!

+ 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. Exact formula and Match formula are not finding same matches
    By TMcG in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-23-2018, 09:52 PM
  2. Help finding a formula
    By Xersizeguy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2015, 08:19 PM
  3. [SOLVED] finding the row # in a formula
    By JimLau in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2014, 11:14 AM
  4. Need help with finding a SUM formula
    By cmertel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-01-2013, 04:37 PM
  5. Finding #Name Within a Formula
    By Hejl82 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-09-2008, 01:53 PM
  6. Finding the Right Formula
    By peaspud in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-27-2006, 09:20 AM
  7. [SOLVED] what's the formula for finding 401(k)?
    By Manuel H. Cruz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2006, 12:20 PM

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