Okay so I'm stumped. I'm trying to create a function that will find any letter ("c" for example) in a specified column and grab the value in the cell next to it to add into a larger sum.
Example:
A1=3, B1=c,
A2=4, B2=d,
A3=1, B3=c
should return 4
How would I achieve that in excel-like language?
Assuming you want this in Excel, type the following function in C1
=IF(B1="c", A1, 0)
Drag the cell C1 to fill the column. i.e.
C2 will be =IF(B2="c", A2, 0)
C3 will be =IF(B3="c", A3, 0) etc.
Now use summation on column C.
Related
Is there a way to create a formula in one cell that will change the value in another cell based on some criteria, without scripting? Example: cell a1 contains a numerical value. cell b1 contains a value from a drop-down list, say, "YES,NO". If cell b1 is set to "YES" I want to remove (set to zero) the value in cell a1. What I'd like to do is have a formula in cell c1 that interrogates b1 and sets the value in a1 accordingly. Is the only way achieve this writing code and using setValue?
you cant remove it without a script. you can visually hide it in various ways. if the A1 is subject of further sum (as in your case per your comment) the sum formula can be always altered to reflect desired output. example:
if your formula is
=SUM(A1, C5, D22)
you can do
=SUM(IF(B1="YES", 0, A1), C5, D22)
Use the following on the cell you need the calculation (or zero) on:
=IF (B1="YES",0,SUM(A:A))
Using the given formula, you would do the SUM calculation for the whole Column A if the value on B1 is "YES", if not, then a 0 would be placed on the cell you put the formula on.
I need to insert a value to a cell in excel using formula in another cell.
Say
A1 = "Test"
B1 = formula to insert A1 to C1
C1 = A1
Can I write a formula in B1 to insert value in C1?
I don't need any formulas in C1.
If Yes, What should be the formula?
If there it is next to the cell AND has no value in B2, it is possible, otherwise it is not.
Use Split()
Split(CONCATENATE("Text for B1#Sperator$$",A1),"#Sperator$$",FALSE)
It really depends.
EDIT
Out dated. Only works in google sheets.
Without using VBA or formulas in column C you can't achieve this.
A simple solution using formulas:
In cell C1, paste the following formula and drag it down:
=IF(B1=1;A1;"")
So if the content of cell B1 is equal to 1, your cell at column C will display the respective value of the same row at column A.
I have a simple formula =sum(sum(d5*u300)/g4)
Is it possible to have the formula look up cell A1 for the d, a2 for the 5, a3 for the u, A4 for the 300, A5 for the the g and a6 for the 4. In other word each formula cell reference is made up of the contents of two other cells.This would be used in a selection process to produce a table for a graph. NON Excel Users could then use a drop down list in A1 to select column d etc. With thanks.
Do you mean something like:
=SUM(SUM(INDIRECT(A1&A2)*INDIRECT(A3&A4))/INDIRECT(A5&A6))
? Let's say A1 contains D and A2 contains 5. Then INDIRECT(A1&A2) will return the value of the cell D5.
However, I don't understand why you use SUM with just one argument.
Is there a formula in excel to allow you to obtain the value of another cell WHEN a second cell was value X?
For example, something like:
=GETWHEN(A1,3,B2)
Which would return B2's cell value when A1 is value 3.
So if let's say you had a cell B2=4*B1. And B1 you set to 3, so B2 would show 12. But I want to make a row of entries to plot what B2 will be when A1 is 1, 2, 3, 4, 5 etc...
What could I put under A1 Values?
EDIT: I'm not looking for a if like in the conditional sense. I'm looking for the value WHEN (edited now)
You're thinking about data tables.
Provided you have your values in E2:E6, and your formula in B2:
Enter =B2 in cell F1.
Select E1:F6.
Go Data - Data table and put B1 into the Row input cell box (B1 being the cell on which B2 depends).
How do I sum from whats in B2 to C2 ?
B2 = A10 or just 10 (preferred)
C2 = A25 or just 25 (preferred)
Normally you would just use SUM(A10:A25), but the values in B2 and C2 are not fixed, they change based on input.
I can use MATCH to find the numbers, but how do I tell SUM to use those numbers ?
The values to sum are always in the same column.
You can use the INDIRECT function for this, e.g.
=SUM(INDIRECT(B2):INDIRECT(C2))
if you can live with entering the entire cell name (A10, A25).
Or to just have the numbers in B2 and C2, you could use
=SUM(INDIRECT(ADDRESS(B2;1)):INDIRECT(ADDRESS(C2;1)))
(Hope I got the columns and rows in the right order!)
You want to specify Cell Co-ordinates in the value of a Cell ?
Is that what you're getting at ?
Try Setting
B1 = "A10"
C1 = "A25"
D1 = =SUM(INDIRECT(B1):INDIRECT(C1))
Use the INDIRECT() function. You pass it a string that is a range, which allows you to have a dynamic range based on input.