DRAFTING A FORMULA

Charles Braught 0 Reputation points
2026-08-12T21:36:20.3933333+00:00

SAMPLE FORMULA FOR EXCEL. ADD AMOUNTS IN ONE CELL BASED ON THE CONTENTS OF ANOTHER FIELD ON THE SAME ROW

Microsoft 365 and Office | Excel | For business | Windows

2 answers

Sort by: Newest
  1. Hendrix 1,005 Reputation points Independent Advisor
    2026-08-12T21:56:16.0933333+00:00

    Hi Charles,

    Regarding your concern, there are a lot of approaches to achieve your goal, depending on your worksheet structure. You can use XLOOKUP/VLOOKUP from the forum's AI-suggested answer, or you can use SUMIF/SUMIFS. For example, I have this data table:

    Category (col A) Amount (col B)
    Food 25
    Travel 40
    Food 15
    Office 30

    If I want to add all amounts in Column B where Column A says "Food", I will use this formula =SUMIF(A:A,"Food",B:B) and I will get the result 40.

    That said, for the best possible assistance, please share some sample data or a screenshot of your current worksheet structure and your expected outcome so I can clearly understand your situation and provide better guidance.

    Please understand that my initial reply may not always immediately resolve the issue. However, with your help and more detailed information, we can work together to find a solution.

    Thank you for your cooperation and understanding. Hope to hear from you soon.


    Note: Please follow the steps in the forum documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. AI answer

    2026-08-12T21:36:36.21+00:00

    If the goal is to return an amount from one cell based on the value in another field on the same row, a lookup formula is the usual pattern.

    Example:

    =C2*XLOOKUP(TRUE,$A$2:$A$5,$B$2:$B$5)
    

    What it does:

    • Looks in A2:A5 for TRUE
    • Returns the matching value from B2:B5 on the same row
    • Multiplies that returned value by C2

    If only a simple same-row calculation is needed, Excel formulas start with = and can use cell references directly, for example:

    =A2+B2
    

    or

    =H2+4
    

    For totals across cells or ranges, a function such as SUM can be used, for example:

    =SUM(A1:A2)
    

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.