I am trying to vlookup (bring back) all the products that are yes, but only the first result keeps coming back because the vlookup gets stuck on the first piece of data.
I am using much more data than the range below but please see below as example.
A1 = Yes B1 = Product 1
A2 = Yes B2 = Product 2
A3 = Yes C3 = Product 3
=vlookup("Yes",$A$1:$C$3,2,false)
It works if I take out the $ signs but then I just get repeat values.
I am guessing this needs a different function but am unsure what to use.
Thanks
Ian
Check this link and understand how that formula works. In your example, put this formula into cell D2 and press CTRL+SHIFT+ENTER and fill down using mouse:
=IFERROR(INDEX($B$1:$B$12, MATCH(0,IF("yes"=$A$1:$A$12,COUNTIF($D$1:D1, $B$1:$B$12),""), 0)),"")
Related
Ok, so I am trying to do something I thought was very simple, but it is turning out to be more complicated.
What I am trying to do:
Take a value through an if statement and return 1 or 0. But I want to be able to change the formula by changing values in cells and not editing the formula itself.
Example:
cell A1 = 41%
cell B1 = >
cell C1 = 40%
cell D1 = Formula with calculation
I want to create a formula that will tell me if that 41% is > than 40%, but if I change that > in B1 for a < (in a separate cell outside the cell with the formula) or I change C1 I want it to recalculate.
I have tried the following:
=IF(A1&B1&C1,1,0)
=IF(A1&INDIRECT(B1)&C1,1,0)
=IF(INDIRECT(A1)&INDIRECT(B1)&INDIRECT(C1),1,0)
all of these result in errors and I cannot figure out how to make it work. I am assuming it is taking the > and making it a string instead of a part of the formula.
Thanks for the help.
=COUNTIF( A1, B1&C1 )
... seems to do the trick, although converting C1 to text may give some rounding errors
An alternative would of course be to enumerate all the operations:
=--IFS( B1=">", A1>C1, B1="<", A1<C1 )
And add other operators as you come across them (NB the -- turns TRUE/FALSE into 1/0)
I have this data in Excel
A1 = 12
A2 = 10
A3 = 1
A4 = 6
I would like to return the position of the A1:A3 value that is the shortest distance from A4. Therefore you need to compare the ABS(A1-A4) to ABS(A2-A4) to ABS(A3-A4). The answer in this case is 2.
From Excel formula position of minimum value
the answer should be
=MATCH(2,1/FREQUENCY(MIN(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)),(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)))
That returns an error.
Another solution should be
=MATCH(MIN(ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)),{ABS(A1-A4),ABS(A2-A4),ABS(A3-A4)},0)
That also returns an error. I know I can calculate the above in multiple steps(cells) or VBA but I need to have one formula that returns the answer. Thanks.
You need the following simple array formula, enter it then press CtrlShiftEnter
=MATCH(MIN(ABS(A1:A3-A4)), ABS(A1:A3-A4),0)
CtrlShiftEnter
I have data in column A and B have lookup data.
For A2 (FY|F|V|D|Safety|3M). take the B column first value and search whether there is any match if not take second value in B column and repeat the process for all the B column values and if there is match print the B column value in Result. Does that make sense?
I tried with VLOOKUP but no luck. Please help me.
Columns:
A B(Lookup) C(Result)
FY|F|V|D|Safety|3M Toro 3M
FY|F|V|D|POP|ToroDays 3M Toro
FY|F|V|D|Lumber|GroundContact honeywell NA(Not available)
FY|F|V|D|airfilters|honeywell samsung honeywell
Enter the following formula in Cell C2
=IFERROR(INDEX($B$2:$B$5,MATCH(TRUE,IF(FIND($B$2:$B$5,A2)>0,TRUE),0)),"NA")
This is an array formula so commit it by pressing Ctrl+Shift+Enter. Drag/Copy down as required. Change range as needed.
See image for reference.
NOTE : Above formula is case-sensitive. If you want non-case-sensitive result you can use following formula.
=IFERROR(INDEX($B$2:$B$5,MATCH(TRUE,IF(FIND(UPPER($B$2:$B$5),UPPER(A2))>0,TRUE),0)),"NA")
In C2, put this and drag down:
=IF(ISERR(SEARCH($B2,$A2)),"N/A",$B2)
Here you go. A Google docs spreadsheet you can see.. The screenshots are from it.
Formulas
Results
You could have string with Toro3M in it, or all 4 for that matter.
The solution I have solves that. But you'd need to tweak to add commas or some such seperator.. And conditionally do it if cell in column F-I are zero length.
I have a row that will have weekly values entered. Column B has the initial value, and E has the calculation; as I add values to C, D and so on, I want the calculation to skip the previous columns value when the next column gets a value.
B1-C1=E1 BUT when a value is added to D1, E1 would update to B1-D1=E1
Sorry for the horrible description. This is probably answered somewhere on this site but I am not sure what terms to search.
Many thanks!
you can use an if statement. I am not 100% sure of your problem but something like this might be helpful.
if(A1, A1, 0)
So for your example provided.
=B1-if(D1, D1, C1)
This says if there is a value in D1 use D1 else use C1. This works in this example, because if
D1 is empty or 0 you will use the other cell. This may change for any given problem.
Use this if function in E1:
=IF(D1>0,B1-D1,IF(C1>0,B1-C1,B1))
Then enter a value in B1, then C1 then D1 to see the results.
According to your question, you only have room for two entries after the default B1 value. This statement will handle that.
If you need more fields, nest more if functions. But if's can only be nested 7 deep, so you can only have an initial value in B1 and 7 more cells, C1 to I1 with your formula in J1
If you actual data is as simple as your sample data you could just use:
=IF(LEN(D2)>0, B2-D2,B2-C2)
You could also use:
=IF(ISBLANK(D2), B2-C2, B2-D2)
if you prefer but Len is a little shorter and I believe the ISBLANK() function has flaws, If you have a formula in D2 that has a calculation and you set the result to "" then it will pick up as false. It depends on your needs.
I would do the following.
In E1 paste the following:
=A1-INDEX(B1:D1,1,COUNT(B1:D1))
The count formula will tell how many values are present in the range of B:D column. This will be used to catch the last column with an index formula which will be deducted form A1.
One thing is very important! The values from A to D has to be written in sequence, if one column is missing than the calculation will be false.
Hope I could help!
I have two excel sheets. The first contains a formula for calculation with one input cell (A1), and one output cell (B1). The formula for B1 could be B1 = A1 * 3 (example).
The second sheet contains various values in column A: A1 = 4; A2 = 9; A3 = 5 ... In corresponding column B of this sheet I'd like to get the result of B1 (first sheet) = A1 (second sheet) * 3 for each A (second sheet) input value.
Basically I'd like to treat the first sheet as a function, where A1 is the argument and B1 the result that is passed back to the second sheet's B column.
Sheet 2
A1 4 B1 12 (result from sheet 1)
A2 9 B2 27 (result from sheet 1)
...
Is it possible without macros?
This is built into Excel. In version 2003, use the Data, Table menu.
You can find many examples on the net. Here is one.
You can create such tables with either 1 or 2 entries (parameters).
I don't think so .....
If in B1 Sheet1 you have
3*A1
If you try this in Sheet2 B1
`=SUBSTITUTE(Sheet1!$B$1,"A1",A1)`
it will give
3*4, and Sheet2 B2 will be
3*9etc
But I don't see how you could coerce this to a numberic calculation with formulae without possibly some heavy duty formula string parsing to separate numbers from operators (which is unlikley to flex as desired if you change the entry in B1 Sheet 1)
[Update 2: but fwiw I have done it with a named range]
I used this range name
RngTest
=EVALUATE(3*INDIRECT("rc[-1]",FALSE))
This is a global range name so it will work on any sheet, more powerful than my prior OFFSET effort. It multiplies the cell to the immediate left by 3
so entering =RngTest in B1:B3 (and then in this new example C1:C3 as well)
gives the output you want
I think you want to use this in your sheet two column.
Sheet1!B1 * Sheet2!A1
Entirely without VBA: expect lots of pain, I won't go there. But...
To substantially reduce the amount of pain, you could actually use this one tiny VBA user-defined function (not technically a "macro"), basically just a wrapper to make VBA's Evaluate function available in worksheet formulas:
Function eval(myFormula As String)
eval = Application.Evaluate(myFormula)
End Function
You could then use it like this in cell B1 on sheet 2:
=eval(SUBSTITUTE(Sheet1!$B$1,"A1","A"&ROW()))
Note that this requires Sheet 1 cell B1 to contain A1*3 and not =A1*3, i.e. no equal sign. Maybe with a bit more fiddling around, it can be made to work even with the = sign there...
EDIT: Actually, if you format Sheet 1 cell B1 as Text before typing in the formula, this will work even if your formula starts with a =.
Is it possible without macros?
Yes!
You can now use =LAMBDA for this.
Define your function using the name manager, then reference it in your second sheet's formula.
See syntax at Introducing the LAMBDA function.
For more information about how to use the LAMBDA function, see the support documentation.