+ Reply to Thread
Results 1 to 14 of 14

Google Sheets: compare 2 column on different sheets and sum

  1. #1
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Google Sheets: compare 2 column on different sheets and sum

    Hi all,

    I am working on an app build with Glide and attempting to create a clock-in and clock-out timesheet. However, I am having trouble with a formula.

    I want to sum the total duration of hours (sheet 2, column E) based on the job name in (sheet 1, Column A). The formula should do the following:

    1- Compare column A on sheet 1 with column A on sheet 2
    2- If the text in any row on sheet 1 column A, matches the text in sheet 2 column A
    3- Sum the corresponding row values in sheet 2 column E

    the formula I am currently using is:
    =sumif(Timesheet!A:A, Project!A:A,Timesheet!E:E)

    This formula works appropriately, however... I want to add ArrayFormula to the beginning which does not work with SumIf.

    I believe I need to use an If, Then statement, however, am not sure how to write that.

    Any help would be appreciated.

    Thank you!
    Last edited by AliGW; 09-19-2021 at 01:47 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Formula Help - compare 2 column on different sheets and sum

    Hi joeartist,

    Please attach a sample workbook with some samples of what you are trying to achieve.

    Follow the "yellow" banner above on how to post a sample workbook
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Re: Formula Help - compare 2 column on different sheets and sum

    example Excel Attachment

    Adjustment:

    Compare sheet 1 "Project" column A to sheet 2 "Timesheet" column A
    If the text in any row, column A match
    Sum the values in sheet 2, column D
    Show the summed value in sheet 1, column H

    Currently in sheet 1, column H I am using this formula: =SUMIF(Timesheet!A:A,@ Project!A:A,Timesheet!D:D)
    however, I would like to use ARRAYFORMULA and that does not work when using SUMIF.

    I believe I need to use an IF THEN Statement. Any help would be appreciated.

    Thank you
    Attached Files Attached Files
    Last edited by joeartist; 09-18-2021 at 08:15 PM. Reason: more information

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Formula Help - compare 2 column on different sheets and sum

    Hi joeartist,

    I'm sorry, but this part...

    however, I would like to use ARRAYFORMULA and that does not work when using SUMIF.
    ...doesn't really make sense. Sumif in itself is an Array formula >> =SUMIF(Timesheet!A:A,A2,Timesheet!D:D)

    If you want to Sum up everything from sheet Tmesheet that matches Project A on the Project sheet, then please tell me why the current formula in H2 is returning the wrong results?
    Last edited by jeffreybrown; 09-18-2021 at 09:00 PM.

  5. #5
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Re: Formula Help - compare 2 column on different sheets and sum

    Hi jeffereybrown,

    A little back story: I am building out an app for the first time using the service Glide (https://www.glideapps.com).

    It is my understanding that in order to have the formula =SUMIF(Timesheet!A:A,A2,Timesheet!D:D) automatically populate with a new data entry form the app, I need to have ARRAYFORMULA as part of the current SUMIF formula. Reading like this: =ARRAYFORMULA(SUMIF(Timesheet!A:A,A2,Timesheet!D:D)).

    Sorry if this is not easy to follow.

    If you look at https://docs.glideapps.com/all/refer...s/arrayformula GlideApp, explains why ARRAYFORMULA is needed.

    Here is an except:

    You’ve probably written a formula in the first row of your sheet and then copied it all the way down the column. However, this can cause issues:
    When new rows get added – the formula doesn't get copied down. Glide can see this formula and can count it as an existing – even if you don't see data in your sheet. This results in new records that are added in your Glide app appearing at the bottom of your sheet Well =ARRAYFORMULA can help with that. The =ARRAYFORMULA can be used for lots of things but one of the simplest is copying.


    I hope this helps you better understand the concept of what I am trying to do. In a nut shell, I am looking for the above formula to be copied to any new entry of data. That way I can track the total hours for each project, based on the timesheet clock in and out.

    Thank you

  6. #6
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Formula Help - compare 2 column on different sheets and sum

    I'm still confuse.

    =sumif(Timesheet!A:A, Project!A:A,Timesheet!E:E)

    for Timesheet , if you got a new row (insert/append), the formula still refer to a new row.
    but if you have new row in Project, format as table may help.

    Regards.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: compare 2 column on different sheets and sum

    ARRAYFORMULA is a Google Sheets function, so this is not an Excel query. I am moving the thread to the correct section.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Re: Google Sheets: compare 2 column on different sheets and sum

    Hi Ali,

    Thank you for transferring this thread to the right forum. I was not aware that ARRAYFORMULA was only used in Google Sheets.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Google Sheets: compare 2 column on different sheets and sum

    Moreover, there is no 2020 version of Excel! Please update your profile with the version of Excel that you are using, or, if you are using Google Sheets predominantly, with Google Sheets. Thanks.

  10. #10
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Google Sheets: compare 2 column on different sheets and sum

    as mentioned by others, ArrayFormula() is just how google sheets wraps an array formula, in excel an array is wrapped in {curly brackets} by using CTRL + SHIFT + ENTER.

    so if the formula works without it then there is no valid reason for adding it in "just for the hell of it"

  11. #11
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Re: Google Sheets: compare 2 column on different sheets and sum

    In the simplest form here is what I am trying to achieve:

    If the project name on either sheets in column A matches, sum the corresponding values from column D on sheet "timesheet" in column H on sheet "projects"

    When a new row is added on sheet "project" I need the formula in column H to auto fill the new values based on the formula.

  12. #12
    Forum Contributor
    Join Date
    12-17-2013
    Location
    ON, Canada
    MS-Off Ver
    MS 365
    Posts
    171

    Re: Google Sheets: compare 2 column on different sheets and sum

    Hi joeartist,

    See if the link below does what you want. There are 2 formulas in the blue cells on the Project sheet.

    https://docs.google.com/spreadsheets...it?usp=sharing

  13. #13
    Registered User
    Join Date
    11-07-2020
    Location
    Chicago, IL
    MS-Off Ver
    Excel for Mac 16.4 + Google Sheets
    Posts
    16

    Re: Google Sheets: compare 2 column on different sheets and sum

    Hi Flyboy65,

    That did the trick, thank you for your help.

    I am not sure what the =SORT(UNIQUE(Timesheet!A2:A))formula is for. When I put that into the google sheet I got a #REF! error. Not sure why, but the other formula worked perfectly.

    Thank you

  14. #14
    Forum Contributor
    Join Date
    12-17-2013
    Location
    ON, Canada
    MS-Off Ver
    MS 365
    Posts
    171

    Re: Google Sheets: compare 2 column on different sheets and sum

    joeartist,

    The SORT(UNIQUE(Timesheet!A2:A)) gives you a sorted unique list of the different Projects in Column A of the "Timesheet" sheet. If it isn't working for you, check that the range of cells (A2:A) is correct. If you still need help, perhaps you can post a link of your Google Sheet.

+ 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. Compare two sheets column by column and insert an empty column with a header
    By MCGOM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2019, 04:07 AM
  2. Compare Sheets and Display the previous sheets column in current sheets
    By maddyrafi1987 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 05-09-2017, 04:03 AM
  3. Compare column in different sheets
    By danlRB80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-14-2014, 10:06 AM
  4. Replies: 6
    Last Post: 01-08-2014, 01:56 PM
  5. compare 2 sheets on one identical column and update another column
    By ashland in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-11-2011, 04:00 PM
  6. Compare two column from two different sheets
    By darkhorse4321 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2010, 09:35 AM
  7. Compare 2 column list across 2 sheets
    By GerryK in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM

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