I have been scratching my head trying to work this out, I would be grateful if you can help.
The formula below offsets 3 places when it finds “Earnings for Period”. However if that cell is enter or zero “0”, I want it to offset 4 places. Any suggestions?
=OFFSET(INDEX($C$2:$C$100,MATCH("Earnings for Period",$C$2:$C$100,0),1),0,3)
There's a few things you could do. The easiest, though not very pretty:
=IF(VLOOKUP("Earnings for period",$C$2:$G$100,3,0)=0,VLOOKUP("Earnings for period",$C$2:$G$100,4,0),VLOOKUP("Earnings for period",$C$2:$G$100,3,0))
We enter 3 vlookup statements. The first is used in the comparison of the IF() statement and will return 0 if the result is either blank or 0 (Depending on the format of your data, if there is a zero length text "" you may need to check for that). Depending on the result, we either do a vlookup for the 3rd column or for the 4th column.
Related
I got a problem with my Excel, where it shows a same name twice, if the 'racers' have the excact same time. For example in the picture the racers 7 & 9 and racers 5 & 10 have the same time, but in the Start grid it shows the same name twice. It should be 4. Racer7 5. Racer9 & 9. Racer5 10. Racer10
The Function of Cell I3 =IF(OR(ISBLANK(B3);ISBLANK(C3));"";INDEX($B$3:$B$32;MATCH(J3;$D$3:$D$32;0))) (I have to use format ';' instead of ',') Function of cell J3 =IFERROR(SMALL($D$3:$D$32;H3);"")
Link to the file (does not work in Google Sheets & the functions have to use local formatting)
xlsx file
MATCH and RANK Getting Sick When Handling Time
Formulas
COMMA
[D3] =IF(NOT(ISNUMBER(C3)),"",ROUND($D$1-A3*"00:10,0"-C3,8))
[H3] =IF(ISNUMBER(K3),RANK(J3,D$3:D$32,2),"")
[I3] =IF(IFERROR(INDEX($B$3:$B$32,SMALL(IF($D$3:$D$32=J3,ROW($J$3:$J$32)-ROW(J$3)+1),COUNTIF($J$3:$J3,J3))),"")=0,"",IFERROR(INDEX($B$3:$B$32,SMALL(IF($D$3:$D$32=J3,ROW($J$3:$J$32)-ROW(J$3)+1),COUNTIF($J$3:$J3,J3))),""))
[J3] =IFERROR(SMALL($D$3:$D$32,A3),"")
[K3] =IFERROR(J3-J$3,IF(I3="","","disqualified"))
COLON
[D3] =IF(NOT(ISNUMBER(C3));"";ROUND($D$1-A3*"00:10;0"-C3;8))
[H3] =IF(ISNUMBER(K3);RANK(J3;D$3:D$32;2);"")
[I3] =IF(IFERROR(INDEX($B$3:$B$32;SMALL(IF($D$3:$D$32=J3;ROW($J$3:$J$32)-ROW(J$3)+1);COUNTIF($J$3:$J3;J3)));"")=0;"";IFERROR(INDEX($B$3:$B$32;SMALL(IF($D$3:$D$32=J3;ROW($J$3:$J$32)-ROW(J$3)+1);COUNTIF($J$3:$J3;J3)));""))
[J3] =IFERROR(SMALL($D$3:$D$32;A3);"")
[K3] =IFERROR(J3-J$3;IF(I3="";"";"disqualified"))
Why is MATCH 'miscalculating' to '7' instead of '6' in cells 'I6' and 'I7' in OP's worksheet (formula in 'D3')?
Time has a ton of decimals so I guess it's 'seeing' the values in 'D8' and 'D9' as different values. To avoid this you can round the values. If you want to use only these values it is enough to round them to 8 decimals for the numbers to be recognized as different even by a millisecond. If you want to sum them there might be some inaccuracies. In OP's case 8 decimals is more than enough.
RANK (formula in 'H3') is also 'miscalculating' if no rounding.
Why the long formula?
Best try it with and without the IF statement and see for yourself.
Here's a Hint:
For this you need a tie breaker. The unfortunately best way of doing this is using a helper column. In my test sheet I used column E but the column could, of course, be anywhere. More importantly, it could be hidden. In this column you enter a formula like
=D3+ROW()/10^8
The point is that the addition must be so small that it makes no difference to the result on rounding. So, the number of results you treat in this may makes a difference. If you find that the addition changes the result in the last row, increase the exponent. The change I made add 0.0001 seconds to each result, multiplied by the row number: 0.0001 in the first row, 0.0002 in the second, 0.0003 in the third etc. Check the results in the 10th and 100th row.
Now the results in column E are all different and it's these results that are used in columns J and I.
[J3] =SMALL($E$3:$E$32,H3)
and
[I3] =INDEX($B$3:$B$32,MATCH(J3,$E$3:$E$32,0))
There will be no more duplicates but the "winner" of a draw is decided by his position in the list.
A solution in old school array-formula-style would be:
Note It's an array-formula which needs to be confirmed through CTRLSHIFTENTER
=IF(OR(ISBLANK(B3),ISBLANK(C3)),"",INDEX($B$1:$B$32,SMALL(IF($D$1:$D$12=J3,ROW($J$1:$J$12)),COUNTIF($J$1:$J3,J3))))
The IF checks the timelist for the current time value and gives all matching lines back which are getting ranked by small. COUNTIF counts the occurences of the current time up to the current line.
Within Excel, is there an array formula or something else that could shorten the formula below? This is only an example going through 12 rows. The actual formula would have thousands of rows, which is why I'd like to find a way to write this formula much shorter. I've considered and tried SUMIF and SUMPRODUCT in addition to what's below, but I haven't found a way for it to check for a specified value in multiple columns, and then doing that for many rows, like a FOR loop would do. The below formula is in Cell J3. I have attached an image of the spreadsheet example.
=SUM(
IF(ISNUMBER(MATCH($I$3,$B3:$E3,0)),$F3,0),
IF(ISNUMBER(MATCH($I$3,$B4:$E4,0)),$F4,0),
IF(ISNUMBER(MATCH($I$3,$B5:$E5,0)),$F5,0),
IF(ISNUMBER(MATCH($I$3,$B6:$E6,0)),$F6,0),
IF(ISNUMBER(MATCH($I$3,$B7:$E7,0)),$F7,0),
IF(ISNUMBER(MATCH($I$3,$B8:$E8,0)),$F8,0),
IF(ISNUMBER(MATCH($I$3,$B9:$E9,0)),$F9,0),
IF(ISNUMBER(MATCH($I$3,$B10:$E10,0)),$F10,0),
IF(ISNUMBER(MATCH($I$3,$B11:$E11,0)),$F11,0),
IF(ISNUMBER(MATCH($I$3,$B12:$E12,0)),$F12,0),
IF(ISNUMBER(MATCH($I$3,$B13:$E13,0)),$F13,0),
IF(ISNUMBER(MATCH($I$3,$B14:$E14,0)),$F14,0))
Use SUMPRODUCT like this:
=SUMPRODUCT($F$3:$F$14*(MMULT(N($B$3:$E$14=I3),TRANSPOSE(COLUMN($B$3:$E$14)^0))>0))
This is an array formula and it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Improved solution
=SUMPRODUCT($F$3:$F$14,CEILING(((($B$3:$B$14=$I3)+($C$3:$C$14=$I3)+($D$3:$D$14=$I3)+($E$3:$E$14=$I3))/4),1))
Idea : 4 is the number of rows/week. Use ceiling() to normalize value instead of int() n sqrt().
Expansion note : just add another row condition & adjust 4 to the number of rows.
Past solution (for reference)
=SUMPRODUCT($F$3:$F$14,INT(SQRT(INT(SQRT(($B$3:$B$14=$I3)+($C$3:$C$14=$I3)+($D$3:$D$14=$I3)))+($E$3:$E$14=$I3))))
should do.
idea : while $B$3:$B$14=$I3 part is creating an array of 0 n 1, the INT() n SQRT() function 'force' the '+' sum to become 1 even if there is more than 1 match in the same month.
please share if it works/not. (:
p/s : (note for expansion) Upon dissecting the int() and sqrt() function, you can see that sqrt(3)=1.73205 , sqrt(2)1.414213, sqrt(1)=1 and its int() results the same value (1) . So let say you want to add more rows, just use 'bundle' 3 rows together in one int(sqrt(__)) function, recursively.
I have a Vlookup with a Match. The Vlookup looks for a country and the match looks for a weight. Each weight for different countries has a different cost.
My formula seems to return the result to the left of what I would expect. So 65kg is returning the cost of 60kg.
This is the code that I have used. I have tried including 1+ in front of D9. I have had False as 0 and I have tried changing the 0's to 1 and -1.
"=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!D3:AU3,0),FALSE)"
Hope this makes sense.
Thank you for any help.
Match returns the relative position in the range. so the fact that the third criterion in the VLOOKUP is 1 based not 0 based you need to start the range in the MATCH with the same column as in the VLOOKUP:
Change Express!D3:AU3 to Express!C3:AU3
=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!C3:AU3,0),FALSE)
Try this formula:
=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!D3:AU3,0)+1,FALSE)
=(Countifs(B:B;”*”;F:F;”<>*1”))
Why doesn't this work?
I want to count all the rows in the sheet, except the ones that has a number that ends with 1 in column F. It just count all the rows, even the ones in column F that ends with 1.
How do I exclude those?
edit
Some more information!
This is a sample of the data:
Could be up to 8000 rows some days. Column B always says "Independent instruction" so I'm using that as a base to count all the rows. Column F contain only numbers, or blank cells (meaning a number will be added later). I still want to count those rows as well (that's blank). It's just the rows that has a number in column F that ends with 1 that I want to exclude!
SUMPRODUCT gives a bit more flexibility for criteria that involve more than straightforward string-matching:
=SUMPRODUCT(--(LEN($B:$B)>0),--(RIGHT($F:$F,1)<>"1"))
The array formula:
{=COUNT(IF((F:F<>"")*(MOD(F:F;10)<>1);F:F))}
will count all non empty cells in the conditions of your question.
Don't forget to press Ctrl+Shift+Enter to place the formula.
Why doesn't this work?
Apart from the fact that you have transcribed it incorrectly (i.e. missing =, and smart quotes ”) the 'F' condition in quotes is a Text value, a formatting issue #BigBen has mentioned in connection with the 'B' values.
You say It just count all the rows so, syntactically corrected, your formula must be working on (a) all 'B's populated (with Text) and (b) all 'F's Numeric. As 1 and "1" are not the same, none of your entries in ColumnF will be excluded by your attempt (none end in "1", though presumably some do end in 1).
#Pspl's A works because its condition (for the 'F's) is based on MOD (applies to Number format values) and #jsheeran's A (my preference) because RIGHT is a string function that returns Text format even from a Number format value.
Put another way, with say 1 in F1, =F1="1" returns FALSE (so =F1<>"1" and =F1<>"*1" return TRUE - that would not suit you) whereas =RIGHT(F1)="1" returns TRUE (or, to suit you, RIGHT(F1)<>"1" returns FALSE).
You can try to use a combination of SUM and IF. Remember to adjust the formula to match your Excel formatting, i.e. replace commas (,) with semicolon (;).
This is an array formula (enter with Ctrl+Shift+Enter)
=SUM(IF(MOD($F$2:$F$25,10)<>1,1,0))
Result (updated with your data set):
When pasting the image into merged cells, the error looks like that:
So you need to make sure the formula is pasted into a single (not merged) cell.
Array formula for values greater than 1000:
=SUM(IF((MOD($F$2:$F$25,10)<>1)*($F$2:$F$25>1000),1,0))
Array formula for values less than 1000:
=SUM(IF((MOD($F$2:$F$25,10)<>1)*($F$2:$F$25<1000),1,0))
Example:
I have an array of data that contains 3 columns and the rows increase as more data gets added. I have some known values such as XX-12345, XXX-12345 or XXXX-12345 that I need to identify and return the content in that cell. The problem is that the naming convention isn't standard, so the value may look like the following: XX-12345-Temp, XX-12345.Temp XXX-12345-Temp, XXX-12345.Temp or XXXX-12345-Temp, XXXX-12345.Temp
Below is the code that I have to perform this function, but it doesn't always work. Sometimes it returns a zero and I cannot figure out why it is doing that.
=INDIRECT("R"&REPLACE(TEXT(MIN(IF(ISNUMBER(SEARCH(F2,$A$2:$C$15349)),(ROW($A$2:$C$15349))*1000+COLUMN($A$2:$C$15349))),"000000"),4,0,"C"),FALSE)
I'm not sure you really need to be involving REPLACE in this construction. You can use:
=INDIRECT(TEXT(MIN(IF(ISNUMBER(SEARCH(F2,$A$2:$C$15349)),10^5*ROW($A$2:$C$15349)+COLUMN($A$2:$C$15349))),"R0C00000"),FALSE)
Regards
That formula will only work up to row 999 because at row 1000 ROW*1000 = 1,000,000 and that will break "000000" in the formula - try this version which will work for ranges up to 99,999 rows
=INDIRECT("R"&REPLACE(TEXT(MIN(IF(ISNUMBER(SEARCH(F2,$A$2:$C$15349)),(ROW($A$2:$C$15349))*1000+COLUMN($A$2:$C$15349))),"00000000"),6,0,"C"),FALSE)
I changed the "000000" to "00000000" and because of that the 4 in REPLACE function needs to be a 6