I am looking for a formula that gives me the closest value in a specific row in a table and another formula that gives me the column number where the value was found.
Thank you,
Debby
Fill these two array formulas into b16:b17 finishing each with ctr+shift+enter.
=AGGREGATE(15, 6, (INDEX(B4:I11, MATCH(B14, A4:A11, 0), 0))/(ABS(INDEX(B4:I11, MATCH(B14, A4:A11, 0), 0)-B15)=MIN(ABS(INDEX(B4:I11, MATCH(B14, A4:A11, 0), 0)-B15))), 1)
=AGGREGATE(15, 6, COLUMN(A:H)/(ABS(INDEX(B4:I11, MATCH(B14, A4:A11, 0), 0)-B15)=MIN(ABS(INDEX(B4:I11, MATCH(B14, A4:A11, 0), 0)-B15))), 1)
Related
I am trying to isolate a sort by a number found at the end of a cell's value (i.e "APG-1710-082521-A4" and returning the value "4")
This is the formula that I am using:
=RIGHT(A2,LEN(A2)-SEARCH("$",SUBSTITUTE(A2,"A","$",LEN(A2)-LEN(SUBSTITUTE(A2,"A","")))))
This formula works for getting the number isolated in a new column, but when I sort that column, it only sorts by the first digit
Example:
1,
1,
1,
1,
12,
14,
15,
15,
15,
17,
2,
2,
2,
225,
What can I do to make sure that the whole number/cell value is being read?
The key to make your own formula work is given by #BigBen, but your formula is rather lenghty. Here is a formula that will extract the number from the right of your string:
=-LOOKUP(1,-RIGHT(A1,ROW($1:$99)))
If you must make this dynamic (length-wise) you can both try (depending on your version of Excel):
=-LOOKUP(1,-RIGHT(A1,ROW($A1:INDEX($A:$A,LEN(A1)))))
Or:
=-LOOKUP(1,-RIGHT(A1,SEQUENCE(LEN(A1))))
I have this COUNTIF formula:
=COUNTIF(A1:A20,A1:A20&"")
When I highlighted the formula and hit F9, I got the following array:
{1;2;2;1;1;1;1;1;1;2;2;2;1;2;4;4;4;4;1;1}
The formula by itself gives 2. I wonder from where the 2 come.
GDPXT01
GDPXT02
GDPXT02
GDPXT03
GDPXT04
PXQZW01
PXQZW02
PXQZW03
PXQZW04
OCCMD2
OCCMD2
DSOMR1
ITY
DSOMR1
PXQZW05
PXQZW05
PXQZW05
PXQZW05
BKXMA01
BKXMA02
It is important to know what is data in A1:A20, but this is result of your function, it is array! For example, for this data-set below you will get same result.
1,
2,
2,
3,
4,
5,
6,
7,
8,
9,
9,
10,
11,
10,
12,
12,
12,
12,
13,
14
We don't have clear understanding about your question unless see your excel sheet.
So I made some points that will helps for your understanding about COUNTIF function. COUNTIF, is used to count cells that match criteria.
=COUNTIF (range, criteria)
range - The range of cells to count.
criteria - The criteria that controls which cells should be counted.
Some Important Notes:
COUNTIF is a function to count cells that meet a single criteria.
COUNTIF can be used to count cells with dates, numbers, and text that
match specific criteria. The COUNTIF function supports logical
operators (>,<,<>,=) and wildcards (*,?) for partial matching.
Some Examples:
=COUNTIF(D5:D12,">100")
=COUNTIF(B5:B12,"jim")
Hope this might helps :)
Because you are using COUNTIF wrong. As per the documentation:
COUNTIF(range, criteria)
range (required) - The group of cells you want to count
criteria (required) - A number, expression, cell reference, or text string that determines which cells will be counted.
This tells you that Criteria accepts only one value, and not a range/array.
If you use the "Evaluate Formula" tool, you will see that your criteria (A1:A20&"") matches the current row. On row 1, it is treated as A1&"". On row 2, it is treated as A2&"". On row 15, it is treated as A15&"". You can also put identical copies of your formula in every row, from 1 to 20, to see this.
As such - on rows 2, 3, 10, 11, 12, and 14 the result will be 2. On rows 1, 4, 5, 6, 7, 8, 9, 13, 19, and 20 the result will be 1. And, on rows 15, 16, 17, and 18, the result will be 4.
As a bonus, rows 21+ will give a result of 0
I currently have generation data over half-hourly time intervals. However there are about 70 entries for each half hour. What I want to do is make a column that aggregates all the generation for each time interval.
Currently my approach is this =SUM(D2:D71) and then in the next cell SUM(D72:D144) etc. Surely there must be a more efficient way of doing this?
Thanks
Hi you can create a pivot table
Ctrl + a your data - Insert - create pivot table
put the interval number in the [Rows] field and put the Energy generated in [Values]
SUMIFS would seem to be useful.
=sumifs(d:d, c:c, ">="&a2+time(8, 0, 0), c:c, "<"&a2+time(8, 30, 0)
=sumifs(d:d, c:c, ">="&a2+time(8, 30, 0), c:c, "<"&a2+time(9, 0, 0)
=sumifs(d:d, c:c, ">="&a2+time(9, 0, 0), c:c, "<"&a2+time(9, 30, 0)
=sumifs(d:d, c:c, ">="&a2+time(9, 30, 0), c:c, "<"&a2+time(10, 0, 0)
'etc ...
The time sequence could likely be resolved with a ROW() function that advances when filled down.
If you copied column C to a new unused column (e.g. column H) and removed duplicates then this should suffice.
=sumifs(d:d, h:h, ">="h2, h:h, "<"&h2+time(0, 30, 0)
I'm trying to cross data to fill a sheet but I'm having some doubts.
I have a number a value in a sheet, and I want to complete it with data from another sheet.
For example:
I want to complete Column C in sheet 1, with the age that appears in sheet 2 (no problem if it copy's the whole cell), but it's not in a specific column. I tried to use vlookup & match, and it's returning an error. a Vlookup the EAN column, and use match the specific string "Age:".
Can you help me? Am I using the right formula
Step 1, find the row you want to work on: (Match on values in Column A)
=MATCH(Sheet1!$A2, Sheet2!$A:$A, 0)
Step 2, grab that entire row via OFFSET or INDEX:
=OFFSET(Sheet2!$1:$1, MATCH(Sheet1!$A2, Sheet2!$A:$A, 0) - 1, 0)
Step 3, find the Age cell in that Row using HLOOKUP and Wildcards ("*"):
=HLOOKUP("Age:*", OFFSET(Sheet2!$1:$1, MATCH(Sheet1!$A2, Sheet2!$A:$A, 0) - 1, 0), 1, FALSE)
(Optional) Step 4, convert to number:
=0 + TRIM(SUBSTITUTE(HLOOKUP("Age:*", OFFSET(Sheet2!$1:$1, MATCH(Sheet1!$A2, Sheet2!$A:$A, 0) - 1, 0), 1, FALSE), "Age:", ""))
Then just drag that down from C2 to however many rows you need. This will find the cell that starts with "Age:" in any column, A:XFD
Edit:
Found this source where it explains how to do It. In your case it would be:
{=INDEX(Sheet 2!E2:CT2,MATCH(FALSE,ISBLANK(Sheet 2!E2:CT2),0))}
This is if your data starts on Row 2 and as you said the age columns are between E:CT
Note how to insert the array formula as is explained on the post of the source.
How can this formula be made with INDIRECT function so that there are no #REF errors when rows are deleted and shifted up. Here is my code:
=IFERROR(INDEX(G5:BL5, MATCH(REPT("z",255),G5:BL5)),0)
You don't need INDIRECT; INDEX will do just as well and is non-volatile.
=IFERROR(INDEX(index(G:BL, 5, 0), MATCH(REPT("z",255), index(G:BL, 5, 0))), 0)
Hard-coding row 5 will stop #REF! errors on row insertion/deletion.