Sample Sheet
Profit
Sales
Expenses
COGS
Hello, I have an array of financial data that I need to turn into profit. I have been able to successfully sum all of the financial together based on a specific date range, but I have encountered a problem with cost of goods sold. Using the match function (apologies if the format is ridiculous, I am new to stackoverflow; the formula is present in the google sheet as well):
=SUM(INDIRECT("'Sales'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Sales!$1:$1,0),4),1,"") &MATCH(A3,Sales!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)))+SUM(INDIRECT("'Expenses'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Expenses!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Expenses!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)))+SUM(INDIRECT("'COGS'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,COGS!$1:$1,0),4),1,"")&MATCH(A3,COGS!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,COGS!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)))
I can sum every value on every sheet by row when matching a list of IDs which is constant throughout all data sheets. My problem is: I only want to sum the cost of goods sold sheet to profit ONLY If there is a corresponding sales value in the same location but on the sales tab. Ive tried replacing the sum with sumif to no avail, as I am just getting the hang of this indirect functions. Can anyone provide me with any information that may help me better understand this problem I'd really appreciate it. Thanks
I think that the COGS was meant to be a one time expense per day. That is how all but the first example are calculated.
If so, I believe the correct answer is:
{=SUM(INDIRECT("'Sales'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)))+SUM(INDIRECT("'Expenses'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Expenses!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Expenses!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)))+SUMPRODUCT(IFERROR(INDIRECT("'Sales'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0))/INDIRECT("'Sales'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,Sales!$1:$1,0),4),1,"")&MATCH(A3,Sales!A:A,0)),0),INDIRECT("'COGS'!"&SUBSTITUTE(ADDRESS(1,MATCH($C$1,COGS!$1:$1,0),4),1,"")&MATCH(A3,COGS!A:A,0)&":"&SUBSTITUTE(ADDRESS(1,MATCH($E$1,COGS!$1:$1,0),4),1,"")&MATCH(A3,Expenses!A:A,0)))}
Without more info I can only come up with that.
=SUM(Sales!B2:I2)+SUM(Expenses!B2:I2)-SUMPRODUCT((Sales!B2:I2<>0)*(COGS!B2:I2))
or
=SUMPRODUCT((Sales!B2:I2)*($C$1<=Sales!B1:I1)*($E$1>=Sales!B1:I1))+SUMPRODUCT((Expenses!B2:I2)*($C$1<=Expenses!B1:I1)*($E$1>=Expenses!B1:I1))-SUMPRODUCT((Sales!B2:I2<>0)*(COGS!B2:I2)*($C$1<=COGS!B1:I1)*($E$1>=COGS!B1:I1))
if dates matters
With the sheet you provided it returns 3.2
Why did you used so much indirect & substitute?
Was it required or fixed ranged fits your need ?
I have a list of all of the sheet names in my workbook on Sheet1 and I am trying, without success, to use the INDIRECT function to reference a cell on another sheet using said name. I am aware that this is a common question, I have looked at about 10 other questions/answers on this website in addition to others. For some reason, those solutions are not working and I am kinda losing my mind.
The sheet names are all in column A
They are named after dates (format mm-dd-yy) <- I'm assuming this is the problem?
The cell that I am trying to reference is always in O1 on every sheet in the workbook.
I have tried:
=INDIRECT(A1&"!O1")
=INDIRECT("'"A1"'&!O1")
and a few other amalgamations. Again, I have looked into so many other solutions at this point I am just left with asking for help with my situation, which is apparently unique (or more likely it is some blaring user error). Please help me before immediately removing the post.
If I have this right, the names of your sheets are dates, and you have the names listed as dates in Column A. So, they will appear as dates, but are actually Excel's background number for a date (days since 1/1/1900).
If you use the Formulas tab in the ribbon to Evaluate Formula, you should see the date pop in to your formula as a 5 digit number.
If you are not doing anything else with these dates, you could try selecting column A and formatting as text. This solved the issue in my test setup. This will still work if you are using the date for other functions, but you will have to tell Excel it's a date using DateValue()
After formatting Column A as text, I used =INDIRECT("'"&A1&"'!O1")
Try,
=indirect(text(a1, "\'mm-dd-yy\'\!\O\1"))
Frequent browser, first time poster. Please go easy:
I have spent the last few days searching online, and on here for a solution to a problem I have encountered for the first time. I have a report that pulls from multiple worksheets. One column is a formula that does a VLOOKUP to another sheet and pulls back a date, if it exists. I then have a cell at the top of the sheet that calculates how many dates are pulled back out of all of the rows (to calculate % complete). This is where I am having the problem. I have tried variations of COUNTIF, COUNTA, COUNTBLANK, and so on, and formulas trying to reverse calculate,
=SUM(C4)-COUNTIF(Table3[2014 Process Date],"")
At first it appeared to work, but in this example, I had 1949 rows, and dates only populated in 7 of those rows. In theory it should return 7. Instead it is returning 237. I have done multiple filters, and manually reviewed the data in the column, and only 7 dates are there. The column has the VLOOKUP in and IFERROR nest,
=IFERROR(VLOOKUP(A12,Table_TaxData.accdb3[#All],240,FALSE),"").
I am guessing I am overlooking something silly, and was hoping someone would be able to help steer me in the right direction, or let me know what I am missing. Thanks in advance for any help!
Wow, looks like I need some more coffee! Thank you, I guess I assumed that it would be much more complicated than that. I just threw in
=COUNT(Table3[2014 Process Date])
And it worked like a charm! Thanks again!
If I'm reading your formula correctly, the target cells hold either the DATE, or a blank "".
If so, you can do a COUNTIF and do this:
=COUNT(B:B)
to get # of dates.
or
=COUNTA(B:B)-COUNT(B:B)
to get # of blanks.
(I used column B, not sure where your final values are in you're looking for - adjust accordingly)
I have simple data, with one column a daily incrementing date column, and the second column being a numeric value. I want to VLOOKUP the data for todays date (which I can do) and then get the average of this value plus the 7 days values before then as well.
Something a bit like:
=AVERAGE( VLOOKUP(today(),A2:B110,2,false)) : (VLOOKUP(today()-7,A2:B110,2,false))
But with the VLOOKUP returning the cell location rather than the data.
As with so many questions on here, I have searched, but I don't know the terms I am looking for and googling anything with VLOOKUP in the terms opens floodgates to questions that aren't quite what I'm asking. Many thanks!
Sounds like your dates are in strictly increasing order, correct? In which case, assuming you're using Excel 2007 or later, you could use:
=AVERAGEIFS(B2:B110,A2:A110,"<="&TODAY(),A2:A110,">="&TODAY()-7)
This INDEX formula will also work, though is not as efficient:
=AVERAGE(INDEX(B2:B110,MATCH(TODAY(),A2:A110,0)):INDEX(B2:B110,MATCH(TODAY(),A2:A110,0)-7))
Regards
I am trying to create spreadsheet to use in a small retail shop.
I have a workbook which contains expenses figures on a sheet and income figure on another sheet.
We can say that the common ground between the both sheets are the month.
I would like to write a function, which will only select those expenses of a specified month.
Something like -
=SUM(IF( Table4[Month]="January", Table4[Amount]))
// I want the sum of all expenses of a given table for only
// those months which are january etc.
I tried using the above, but it failed.
Actually a more refined solution is use the build-in function sumif, this function does exactly what you need, will only sum those expenses of a specified month.
example
=SUMIF(A2:A100,"=January",B2:B100)
This should work, but there is a little trick. After you enter the formula, you need to hold down Ctrl+Shift while you press Enter. When you do, you'll see that the formula bar has curly-braces around your formula. This is called an array formula.
For example, if the Months are in cells A2:A100 and the amounts are in cells B2:B100, your formula would look like {=SUM(If(A2:A100="January",B2:B100))}. You don't actually type the curly-braces though.
You could also do something like =SUM((A2:A100="January")*B2:B100). You'd still need to use the trick to get it to work correctly.
SUMIF didn't worked for me, had to use SUMIFS.
=SUMIFS(TableAmount,TableMonth,"January")
TableAmount is the table to sum the values, TableMonth the table where we search the condition and January, of course, the condition to meet.
Hope this can help someone!