+ Reply to Thread
Results 1 to 4 of 4

How to search in columns and use the sum function

  1. #1
    Registered User
    Join Date
    10-21-2020
    Location
    Phoenix, AZ
    MS-Off Ver
    MS 365
    Posts
    2

    How to search in columns and use the sum function

    See attachment.
    I am trying to have excel only find the difference between the tach time in column A when an "X" is present in column B. For example, C10 should subtract A10 minus A9 since there is an "X" in B9. 1246.6 is not the difference between A10-A9. However the formula works for cell C9. It is searching for the next "X" from B9 and then subtracting A6 from A9. There are similar problems in cells C6, C11 and C14. Can anybody help me find a formula that would work for these calculations?
    Attached Files Attached Files

  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,036

    Re: How to search in columns and use the sum function

    It would have been simpler if you had told us your EXPECTED results, rather than showing us a non working formula. Try this:

    =IF(B2="X",SUM(A$2:A2),"") in B2, copied down.
    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
    10-21-2020
    Location
    Phoenix, AZ
    MS-Off Ver
    MS 365
    Posts
    2

    Re: How to search in columns and use the sum function

    Thanks for helping. Unfortunately I do not want column A to continuously add up. I'll try to give a better explanation. If an "X" is present in column B than I want the number that corresponds to that in column A to be used in a SUM function with the next previous number in that column that has a "X" next to it in column B.

    For example: Cell C6 should have the difference from A6-A5 since there is an "X" in cells B6 and B5. Cell C5 should have the difference from A5-A3 since there is an "X" in cells B5 and B3.

    Hopefully this helps.
    Attached Files Attached Files

  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,036

    Re: How to search in columns and use the sum function

    Still no manually calculated expected answers, but a better explanation:

    =IFERROR(IF(B2="X",A2-LOOKUP(2,1/($B$1:B1="X"),$A$1:A1),""),0)
    Attached Files Attached Files

+ 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. Function to search 3 exact variables from 3 columns in a matrix
    By CapoDiCapi in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-24-2020, 10:48 AM
  2. Need a search function to find a value and return other columns?
    By brumx004 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-24-2015, 02:51 PM
  3. Search Function (Not VBA) on multiple columns
    By Cremorneguy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-19-2014, 10:11 AM
  4. Using SEARCH and IF function to find two columns from one source
    By Tricke86 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 07-18-2014, 05:05 AM
  5. Using SEARCH and IF function to find two columns from one source 2
    By Tricke86 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-27-2014, 06:32 AM
  6. [SOLVED] Need Function to search columns and return a value.
    By SirDrums in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-21-2012, 08:33 PM
  7. Replies: 3
    Last Post: 02-06-2012, 03:32 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