+ Reply to Thread
Results 1 to 16 of 16

sum values on a culumn based on cretiria from another column

  1. #1
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    sum values on a culumn based on cretiria from another column

    Hi, i have 2 columns, the first one is a text column, the second is a number column, i would like to sum all values to the second column that the text in the first column beggins from specific characters

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Well, your description is very general - it is better to refer to specific cells/columns/rows so that we can give you a proposal to suit the layout of your data.

    You should be able to use SUMIF for this. The general syntax for you will be:

    =SUMIF( criteria_range ; criteria ; sum_range)

    Hope this helps.

    Pete

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Note that you can use wildcard characters with SUMIF, so if you just wanted to look for the first 3 characters, for example "abc", then your criteria would be:

    "abc*"

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    I thing it doesn't work because the first 3 characters of a text looks like number (is 123)

  5. #5
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    It is like 123456 10
    123567 20
    124444 30

    And i use formula sumif(A:A,left(A1,3),B:B)

  6. #6
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    Sorry...

    It is like

    123456 10
    123567 20
    124444 30

    And i use formula sumif(A:A,left(A1,3),B:B)

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Attach a sample workbook - you can find details of how to do this in the yellow banner at the top of the screen.

    Pete

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    You must include the asterisk, like this:

    sumif(A:A,left(A1,3)&"*",B:B)

    Hope this helps.

    Pete

  9. #9
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    Pete Thanks but ir still returns 0
    Last edited by AliGW; 12-11-2020 at 07:50 AM. Reason: PLEASE don't quote unnecessarily!

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Act upon my comments in post #7, then.

    Pete

  11. #11
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    Think that i have already done it, realy don't know how it works with attachments
    Please note that Greek excel uses ";" instead of ","
    Regards
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,800

    Re: sum values on a culumn based on cretiria from another column

    D1=sumproduct((left(a1:a3,3)+0=123)*(b1:b3))

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Here's another approach for D1:

    =SUMPRODUCT(--(INT(A$1:A$3/1000)&""=LEFT(A1;3));B$1:B$3)

    You can't use wildcards with numbers, and you can't manipulate the criteria_range within SUMIF, so you need to use SUMPRODUCT.

    Hope this helps.

    Pete

  14. #14
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    Quote Originally Posted by CARACALLA View Post
    D1=sumproduct((left(a1:a3,3)+0=123)*(b1:b3))
    It works, THANKS you are superman

  15. #15
    Registered User
    Join Date
    10-27-2016
    Location
    GREECE
    MS-Off Ver
    2016
    Posts
    43

    Re: sum values on a culumn based on cretiria from another column

    Quote Originally Posted by Pete_UK View Post
    Here's another approach for D1:

    =SUMPRODUCT(--(INT(A$1:A$3/1000)&""=LEFT(A1;3));B$1:B$3)

    You can't use wildcards with numbers, and you can't manipulate the criteria_range within SUMIF, so you need to use SUMPRODUCT.

    Hope this helps.

    Pete
    Pete thanks it works as well...
    Best Regards

  16. #16
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: sum values on a culumn based on cretiria from another column

    Glad we finally got there - hopefully you can now see the advantages of attaching a sample workbook.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    You might also like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. Counting Formula with cretiria
    By baspax1 in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 01-25-2019, 02:10 PM
  2. VB Code to Delete Cell values if cretiria is met
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-13-2015, 10:34 PM
  3. Back office distribution activities in agents based on certain cretiria
    By Eftychia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2015, 07:07 PM
  4. [SOLVED] How to Find just the Culumn where a variable is
    By Edinson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2014, 10:56 AM
  5. Excel 2007 : Sum two cretiria
    By sabrish72 in forum Excel General
    Replies: 2
    Last Post: 06-25-2011, 04:16 AM
  6. Replies: 1
    Last Post: 11-26-2009, 12:02 PM
  7. Replies: 8
    Last Post: 11-26-2009, 10:24 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