If Cell is blank add SUM of another - excel

If a cell in TT[Fiscal Law 301 CBT] is blank i would like to add the numbers in TT[Helper1]
CountBlank doesnt work because I need to sum of column TT[Helper]. Other issues i've tried is counting the number of "" but it always brings back zero.
Please help...

use the following formula
=IF(TT[Fiscal Law 301 CBT]="", TT[Helper1],TT[Fiscal Law 301 CBT])
you would need to generate another table filled with this formula that would check fiscal law for a blank value. when there is a blank it pulls from helper1, and when there is no blank it pulls the value from fiscal law. Normally I would be referencing individual cell address like D2, so there may be an issue with the table referencing method which I am not familiar with.

Related

Get list of rows with a second non-blank value and the column header for the second non-blank occurrence

I have an Excel sheet with data represented as below:
I need to get all the sites with a second non-blank column in the site's row (except Site, of course) and also get the Column Header value.
In the example, sites B, F and G have a second Y. So the result should be:
I am not very well versed with Excel Formulas, but I have experimented a bit with INDEX and I can find the second non-blank value itself. But I can't figure out a way to return the result I require.
Using the below formula I get as far as this, but still nowhere near my expected result.
{=INDEX(B2:I2,SMALL(IF(B2:I2<>"",COLUMN(B2:I2)-COLUMN(B2)+1),2))}
Edit:
With #Harun24HR 's answer I get this new result.
Try below formula.
=INDEX($B$1:$I$1,,SMALL(IF(($B$2:$I$11="Y")*($A$2:$A$11=C14)>0,COLUMN($B$2:$I$11),""),2)-1)
May need array entry with CTRL+SHIFT+ENTER.
Edit#: As per my below screenshot I have used below formulas.
For result column in J2 cell put
=IF(COUNTIF(B2:I2,"<>")>1,ROW(),"")
In C14 put
=IFERROR(INDEX($A$1:$A$11,SMALL($J$1:$J$11,ROW(1:1))),"")
And in D14 cell put below formula.
=INDEX($A$1:$I$1,MAX(($B$2:$I$11<>"")*($A$2:$A$11=C14)*(COLUMN($B$2:$I$11))))
Please note. You no need to array entry for these formulas.
Finally I ended up solving this using a combination of the accepted answer (by #Harun24HR) and How To Extract A Dynamic List From A Data Range Based On A Criteria Without Filters In Excel
In J2 through J11, I added the formula:
{=IFERROR(INDEX($B$1:$I$1,,SMALL(IF(($B$2:$I$11<>"")*($A$2:$A$11=A2)>0,COLUMN($B$2:$I$11),""),2)-1), "")}
In A15 to A24 (same number of rows as the original range), I added the formula:
{=IFERROR(INDEX($A$2:$A$11,SMALL(IF($J$2:$J$11<>"",ROW($A$2:$A$11)),ROW(1:1))-1,1),"")}
In B15 to B24, it's a simple VLOOKUP:
=IFERROR(VLOOKUP(A15,$A$2:$J$11,10,0),"")
This way, the result table is dynamic.

I want to copy a formula which ends in a number, but amend the number in the new formula by a fixed value

In Cell F190 I have the following formula: ='[Account 19617768.xlsx]19617768'!$G$1142 (the cell displays the value in 19617768 $G$1142 - (£1609.50)
I can display this formula in Cell J190 with the formula: =FORMULATEXT(F190)
By manipulating FORMULATEXT(F190) (i.e. Using Left(FORMULATEXT(F190),38)&(Right(FORMULATEXT(F190),4)+2), I end up with Cell J190 displaying formula: ='[Account19617768.xlsx]19617768'!$G$1144.
What I need is for Cell J190 NOT to display the formula, but the actual value in Account19617768.xlsx G1144 (£1859.50), and it's the conversion of the formula into the value I don't seem to be able to find an appropriate function
I don't have a problem if I need to use an additional function in another cell to finish off the conversion?
I know this should be easy, but having just been released from hospital, I seem to be having
trouble working the simplest things out
'$' signs in excel formula keep the preceding data static.
In other words. Remove the $ in G$1065.
Now when you drag the formula down the column the Cell number will increase.
If you keep the $ in front of G the column G will never change no matter where the formula is copied.

IFERROR VLOOKUP Sheets

Frustration finally boiled over and had to post here.
I have a Google Sheet where I want a sheet (LOG) to have a formula that will search for a name on a different sheet (DAY 1), and if the name has a value in the cell adjacent to it, that the formula on DAILY return that adjacent cell value.
Right now, I am using an IFERROR to lead the equation. This will return a value of "0" for when a name does not occur (since different names will occur on different days).
Then I attempt a VLOOKUP, and I think I'm putting the criteria in correctly, but it doesn't give me the answer I want. That is in the document, I want cell B4 on page LOG to reflect that the name Smith, John is found on the page DAY 1, and that there is a value on cell C4.
Can anyone assist with this?
https://docs.google.com/spreadsheets/d/10tS6gqtEpp55OJpYa1jSMKmbm8qU5ZzRu0rqFWHegi0/edit?usp=sharing
You have errors in formula
=IFERROR(VLOOKUP(A4,'Day 1'!A4:A13, 3,FALSE, 0))
You specify parameter 3 - colindex=3 while parameter 2 - range consists of one column
Incorrect placement of brackets
Correct formula:
=IFERROR(VLOOKUP(A4,'Day 1'!A4:C13, 3,FALSE), 0)
In this case VLOOKUP isn't your best option, try using SUMIFS instead:
=SUMIFS('Day 1'!$C$4:$C$13,'Day 1'!$A$4:$A$13,A4)
This function fills your need.
I would also recommend having one tab for all your "raw" data for each day like this:
And using this formula instead, you can drag right and down now:
=SUMIFS('Day 1'!$D$4:$D,'Day 1'!$A$4:$A,B$2,'Day 1'!$B$4:$B,$A4)
Hope you find this more useful :)
-this is my first post
https://docs.google.com/spreadsheets/d/1LXgZfKvUt7lrp4E8tAqaYEmSmZwjEbDYcQD8j1jHReY/edit?usp=sharing

Excel formula to sum as long as

I'm trying to find a formula to calculate the balance of a column until a negative value is found. After the negative value is found, the balance must be calculated again until the next negative value. Basically tracking what you spent, except it only shows a value when you sold something. Anybody have an idea if this is possible to do in MS excel? Thanks!
OK. Now I get your question. I think the following will do the trick. The results exactly match your example.
// In these cells only
F2: =MAX(0,B2*C2)
G2: =MAX(0,B2)+MIN(0,B2)
// In these cells, then copy down
E3: =IF(B3<0,D3-(F2-F3),"")
F3: =F2+MAX(0,B3*C3)+IF(G2=0,0,MIN(0,B3*F2/G2))
G3: =G2+MAX(0,B3)+MIN(0,B3)
I would note a couple of things about this:
1) You might consider changing the names of your columns to trans, quan, $ per, $ ttl, $ gp, and name the 2 columns I am adding $ inv and inv.
2) This is using the average cost of inventory, recalculated with each transaction, not LIFO or FIFO.
3) If entries get out of order such that quan goes negative, I think this solution will fail. In any case, that might be an error you'd want to notice.
4) FYI, the "IF(G2=0" part of F3 is only there to avoid a divide by 0 error when G2 (inventory) is 0. I could have done this other ways, of course. It works.
5) I've left E2 blank on the assumption that you can't sell as you've not bought.
One way would be to add 2 additional columns, which could be hidden or on another sheet, then (here assuming adding columns F2 and G2 added at the right):
In Cell E2: =IF(B2<0,G2,"")
In Cell F2: =B2*C2
In Cell G2: =SUM(F$2:F2)
Copy these down and, assuming I understand your question correctly, you'll get the results you desire.
The biggest problem you've got with this is working out the ranges to check for the balance calculation. This won't work if the next row in your table is a 'sell' while you've still got one 'apple' left from the previous purchase. If you want to do anything more convoluted you should use VBA.
Others will probably have an easier way to work out the ranges; I did it in a rather convoluted way and don't have time to optimise them.
In column F there's an array formula to calculate the last row in the range of 'buys' relevant to that 'sell'.
=IF($B2>=0,"",LARGE(IF($B$2:$B2>0,ROW($A$2:$A2)),1))
In column G there's a normal formula to capture the row number of the first row in the range.
=IF(ROW()=2,ROW(),IF(B2>0,IF(B1<0,ROW(),""),""))
In column H, convert this to be stored in the relevant 'sell' row using an array formula:
=IF($B2>=0,"",LARGE(IF($G$2:$G2>0,$G$2:G2),1))
In column E, balance, use these calculated row range references in an INDIRECT statement to calculate the balance.
=IF(B2>0,"",(C2*-(B2))-(-(B2)*(SUMPRODUCT(INDIRECT("B"&H2&":B"&F2),INDIRECT("C"&H2&":C"&F2)/SUM(INDIRECT("B"&H2&":B"&F2))))))
Note that INDIRECT uses a string to reference cells and ranges and if you move cells or ranges you will have to manually change the INDIRECT string to reference the correct cells.
Responding to #carol, and looking at the Q&A again, specifically where you say " although the problems comes up after because it needs to ignore the balances that came before José and start with the new ones that follow up," I realize that you may be looking to instead display the balance of all sales receipts and purchases since the last sale. If so:
In Cell G2: =F2
Do not copy down the above. Do copy down those below.
In Cell E2: =IF(B2<0,G2,"")
In Cell F2: =B2*C2
In Cell G3: =IF(B2<0,F3,F3+G2)

If/Then Excel Formula

I cannot figure out why this formula isn't working:
=IF(A2="160850",TP,IF(A2="202006",BL,IF(A2="203646",MM,IF(A2="203917",KT,IF(A2="200265",MP,IF(A2="201447",JB,IF(A2="170566",VB"")))))))
Cell A2, A3, and so on, represent commossion codes that are specific to a sales rep.
So, if Cell A2 equals 160850, then I need the cell I place this formula in (C2) to display TP, and so on, based on the formula above.
I have checked and this looks okay to me. However, when I enter this formula in, I get a message that states The formula you entered contains an error.
Can anyone assist?
Thanks so much in advance
You need to put your return values inside quotes, otherwise Excel assumes that TP is a valid name in the workbook (i.e., an address, named range, or variable).
=IF(A2="160850","TP",IF(A2="202006","BL",IF(A2="203646","MM",IF(A2="203917","KT",IF(A2="200265","MP",IF(A2="201447","JB",IF(A2="170566","VB")))))))
There may be additional errors, but this one is apparent.
Wouldn't it be simpler to use a lookup table? List all your commission codes in one column, e.g. Y2:Y10 then list the linked sales rep (initials) in the next column (Z2:Z10) and you can then use this formula copied down the column
=VLOOKUP(A2,Y$2:Z$10,2,0)
The last set of double quotes should be parentheses:
=IF(A2="160850",TP,IF(A2="202006",BL,IF(A2="203646",MM,IF(A2="203917",KT,IF(A2="200265",MP,IF(A2="201447",JB,IF(A2="170566",VB)))))))
You also probably want to take the agent numbers out of quotes or it'll return false because the number entered is numeric and you're looking for a string. The Codes should be in quotes, though e.g. IF(A2=160850,"TP",....

Resources