how to use value in cell to count up to a number - excel

I need help with a formula.
I have a spreadsheet where the user enters an integer in one cell. i need to use that value to place a formula in another cell.
so, for example, user enters 24 in the cell. I need it to place a simple sum formula in the 24th cell of the row immediately to the left and highlight it red.
is there any way to do this?

You would put the SUM formula in an IF() function that is true when the row = the value in the cell:
=IF(ROW()=$E$2,$E$3-SUM($B$1:$B1),"")

OFFSET may be a great option here.
If I understand what you are saying, based on your comment to #ScottCraner's answer, you can use this formula in say P4 or wherever really.
=P3-SUM(OFFSET(P4,0,0,P3,1)
This will work if you do not need the formula to be exactly in the cell P28 or wherever it's defined, but just want to SUM the number of payments based on the trigger in P3.

Related

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.

Is it possible to calculate the sum of a whole row?

I have a file that doesn't have a fixed number of columns.
I was wondering if there is a way to tell excel to put the sum of this row in a specific cell, in a way that each time a column is added to the file I don't have to update the formula and increase the range of the sum.
p.s.
I know I can make it a bit easier by just updating the formula like once in 10 times or so. But I was wondering if it's possible to do it once in a lifetime.
Yes sum(1:1) will sum up all values within the first row.
Keep in mind this does not work if the sum needs to be stored in the same row. As you would create a circularity problem.
If your formula will be in b1, and you want to sum from C1 to the end, then simply:
B1: =SUM(C1:XFD1)
Replace XFD with whatever column you think will be far enough to the right that you'll never have to adjust the formula; or leave it as is.
You could make the range dynamic, with something like:
B1: =SUM(OFFSET($A1,0,2,1,LOOKUP(2,1/ISNUMBER(1:1),COLUMN(1:1))-2))
but since that formula is volatile, it may add excessive time to the calculations.
First: Take note of your first cell (Assumed A1)
Second: Take note of your farthest cell (Assumed AZ1)
Then:
=sum(A1:AZ1)

Cell reference calculation within a range formula

I am using this formula to search a range of cells for the letters "cc".
=COUNTIF(G4:G28,"cc")*G3
This lets us know who paid with a credit card. I was told that we also need to know the date. So now I am adding the date to the cell using this format "cc (10/03)" Of course now the formula does not count this cell because the formula is looking for "cc" only. So now I need to replace the "cc" part of the formula with something that looks in the cell for "cc". I think I can use ISNUMBER but that requires that I enter a specific cell in the formula. Since this formula is being used as part of a formula that contains a range, how would I do this?
Hope this makes sense.
Many thanks,
Houston
If you need to have the date in the same cell then you can use a "wildcard" * in COUNTIF like this
=COUNTIF(G4:G28,"cc*")*G3
then that will count all cells that start with "cc"....or a wildcard either side if you need, i.e.
=COUNTIF(G4:G28,"*cc*")*G3
which would count cells that contain "cc" anywhere.
Ideally you would put the date in a separate cell in the same row so that your original formula would still function OK

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",....

What is wrong with this Excel formula to sum() next 2 columns in the same row?

I did try to enter in a cell formula:
=SUM(ADDRESS(ROW(),COLUMN()+1):ADDRESS(ROW(),COLUMN()+2))
Intention is summing next 2 cell in the same row.
But the spreadsheet complains with error on it!
Used functions: ADDRESS(ROW(),COLUMN()+1). Work fine but together - not!
In B7 cell:
(I need to write a generic formula that is independent from location and calculates the sum of the next tho cell in the same row.
I am not interested in specific addresses or in a way to copy any specifically written formula across a spreadsheet.
I need a formula that works independently from a location!
Is it possible in Excel at all?)
Thanks.
ADDRESS returns address as a string. You cannot SUM it because SUM(A2:A3) is very different from SUM("A2:A3").
You could look into SUM(INDIRECT("A2:A3")), but you should not, for the mere reason that Excel's formulas are already relative unless made absolute.
If you want to sum two cells to the right of B7, enter =SUM(C7:D7) to B7. The formula will change if you copy it to another cell.
If you meant to enter the formula with a macro, then use the R1C1 notation and enter =SUM(RC[1]:RC[2]).
sorry im dont speak english , but a have what you need
= SUM(INDIRECT(CONCATENATE(ADDRESS(ROW();COLUMN()+1);":"; ADDRESS(ROW();COLUMN()+2))))
Regards

Resources