+ Reply to Thread
Results 1 to 9 of 9

Can't Sum numbers generated by a formula

  1. #1
    Registered User
    Join Date
    06-05-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Can't Sum numbers generated by a formula

    Hi,

    I'm making a quick financial aid to help me keep track of my expenses. I copy my credit cards expense on a line, and then I use this formula to divide my expenses into different groups:

    =IF(ISNUMBER(SEARCH("provigo",B2)),D2,"")

    So if excel sees "provigo" in the description, it copies the cost manually added into cell B2 in a new cell (D2) under the column title "grocery" to help me know how much I spend on groceries.

    Except when I sum all the numbers in the "grocery" column, it gives me 0. No idea why. The cell is defined as currency, and I've tried "Text to columns" option (maybe incorrectly) and it doesn't work. See attached excel.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Can't Sum numbers generated by a formula

    Any time you concatenate numbers (using &), the result is text, and you cannot add text. Give me a minute and I will see what I can come up with for you
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Can't Sum numbers generated by a formula

    All the numbers in Columns E:G may look like numbers but in fact are text. Your ampersands (&) make it text. You need to create an If then statement using this format

    =if(cell=x, then y, if(cell=a, then b, else c)) and continue your nesting.

    Look at this link for an tutorial

    https://www.techonthenet.com/excel/f.../if_nested.php
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Can't Sum numbers generated by a formula

    1. Starbucks has a trailing space - remove it.
    2. Make up a list of items to test against for col E extract, (I used col L)...make sure you use the same (full) names)
    use this instead of your IF()'s....
    E2=IF(ISERROR(MATCH(B2,$L$1:$L$6,0)),"",D2)
    copied down as needed.

    This give trhe advantage of allowing you to add names without doing too much changes to the formula (you could also use a named range for the names, then you wont need to change at all)

    Use this same approach for F and G

  5. #5
    Registered User
    Join Date
    06-05-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Can't Sum numbers generated by a formula

    [QUOTE=FDibbins;5551442]1. Starbucks has a trailing space - remove it.
    2. Make up a list of items to test against for col E extract, (I used col L)...make sure you use the same (full) names)

    Hi Thanks for your response. My only problem with this (I think), is the same I would face with Alan's response: I would need the exact full names, but I usually don't have them. For example, every starbucks store usually has a unique number (starbucks 384475, starbucks 323958, etc), which is why I would need the formula to look only for "starbucks". Does that make sense?

    Sorry my excel example did not show that.

  6. #6
    Registered User
    Join Date
    06-05-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Can't Sum numbers generated by a formula

    Hi Alan, thanks for taking the time. See my response to FDibbins below. In short, to use your formula, I would need to know the exact name of every transaction for the IF THEN formula to find it, but in most cases I don't know the exact name, only a word within it.

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

    Re: Can't Sum numbers generated by a formula

    Change the formula in E2 to:

    =IF(COUNT(SEARCH({"five","rotisserie","starbucks","hortons","pizza","BEN&"},B2)),D2,"")

  8. #8
    Registered User
    Join Date
    06-05-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Can't Sum numbers generated by a formula

    Yes! Thank you very much phuocam !!

  9. #9
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,057

    Re: Can't Sum numbers generated by a formula

    Set up the criteria in separate tables: EatingOut, Grocery and Car, then use the following formulas:

    Cell E2: =IF(ISNA(LOOKUP(1E+100,SEARCH(EatingOut,$B2),EatingOut)),"",$D2)
    Cell F2: =IF(ISNA(LOOKUP(1E+100,SEARCH(Grocery,$B2),Grocery)),"",$D2)
    Cell G2: =IF(ISNA(LOOKUP(1E+100,SEARCH(Car,$B2),Car)),"",$D2)

    then copy down.

+ 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. [SOLVED] Accumulated numbers are generated by four conditions
    By metrostar in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-03-2020, 09:09 AM
  2. Store Randomly Generated Numbers
    By 13acarter13 in forum Excel General
    Replies: 3
    Last Post: 05-16-2020, 04:37 PM
  3. [SOLVED] numbers are formula generated, what about IF formula?
    By johnandrews in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-02-2014, 06:03 AM
  4. [SOLVED] How to fix generated random numbers in this formula?
    By omid020 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2013, 03:20 AM
  5. I want random numbers generated without repeating
    By Johncobb45 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-08-2006, 08:53 PM
  6. to find missing serial numbers in randomly generated numbers
    By B.H. Hadi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-01-2005, 07:00 PM
  7. [SOLVED] How do I add the sum of a series numbers generated by Rnd gen?
    By RandomProblems in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-02-2005, 12:06 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