简体   繁体   中英

Match, pull and add numbers from different cells on a different sheet

I have data on 'JobSheet1' in Column D, I have Invoice Numbers in ascending order (some are repeated for different products on same order), in Column E, I have amounts ie £50.00.

On a second sheet 'InvoicesSheet1' in Column B, I have the invoice numbers and Column C is where I would like the total for each invoice number to appear.

Can anyone help with very simple VBA or a formula that will search for the Invoice Number its sitting by in 'JobSheet1' Column D and add all the matching invoice number totals from Column E.

Scott Craner is right, with the schema you described, you will get the result you want entering into cells Ci:Cj (where "i" and "j" are the start and end of your table, respectively):

=SUMIFS('JobSheet1'!E:E,'JobSheet1'D:D,B{i...j})

If this doesn't work, likely issues you need to watch out for would be:

  1. Sheets are not named exactly as you typed here. Maybe they have a leading or trailing space.
  2. Your copy of Excel/Windows may be set with a different regional setting, which requires that formula parameters be separated by semicolons (;) instead of comas.
  3. Your invoice numbers may not be typed precisely the same in the two different formulas.
  4. Your amounts in column E may not be stored as numeric values. You can test for this by selecting a few values from column E - if excel doesn't show their sum and average in the bottom right corner, they are stored as text and you can't perform math operations on them.

I'd need to see your data to see what could be the issue, but that's not what this forum is for - Try constructing a new table with dummy data set up exactly as you described it here and try using this formula, to verify if it works. Then, adjust accordingly as needed.

Assuming you're first invoice number in InvoiceSheet1 is in cell b3, you can use: =SUMIF(JobSheet1!D:D,InvoiceSheet1!B3,JobSheet1!E:E).

If it's in another row, replace InvoiceSheet!B3, with the relevant cell where your data starts. Copy down the formula for the other invoices

SUMIFS is not necessary with just one lookup condition.

I solved this by amending the SUMIFS suggestion from ScottCraner and this is what I ended up with

=SUMIFS(Jobs!K:K,Jobs!A:A,D3)+SUMIFS(Jobs!L:L,Jobs!A:A,D3)

Does the job!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM