excel formula for same data but highest number - excel-formula

I need to know the formula for my data like this :
A B C
234 5
234 4
234 2
255 6
255 3
266 2
266 1
I want to mark same column C with 1 to those having same number in A but highest number in B. thank you.

I think this is what you are looking for
find max min value based on criteria

Related

Counting total number in Excel with a specific value in cells and a single column

Hope someone can help me out with what is probably quite a simple thing in Excel but I just can't seem to be able to work it out. I have a table of numbers which correspond to colour codes:
A
B
C
D
E
F
2
2
2
2
2
24
36
36
2
2
2
24
2
2
2
2
2
2
36
2
36
2
2
24
2
2
36
2
2
2
2
36
2
2
2
24
2
2
2
2
36
2
What I would like to able to have is some way of having a total based on the criteria:
Count the total number of times '36' appears in the table only if the row has '24' in column F
I've tried using COUNTIF and COUNTIFS but that only works for matching sized columns of data.
Any help would be really appreciated.
Use SUMPRODUCT:
=SUMPRODUCT((A1:E7=36)*(F1:F7=24))

Change array of SUMIF in case criteria exists in two different columns

A B C D E F
1 Results List A List B
2 Campaign Sales Campaign Sales Campaign Sales
3 Campaign_A 1.510 Campaign_A 500 Campaign_B 50
4 Campaign_B 120 Campaign_A 450 Campaign_B 40
5 Campaign_C 90 Campaign_A 560 Campaign_B 30
6 Campaign_D 1.650 Campaign_B 700 Campaign_C 80
7 Campaign_E 100 Campaign_B 710 Campaign_C 10
8 Campaing_F 70 Campaign_C 200 Campaign_F 70
9 Campaing_D 850
10 Campaing_D 800
11 Campaing_E 100
12 Campaing_F 320
13 Campaing_F 360
14 Campaing_F 290
15
16
The Excel table above consists of:
List A = Column C:D
List B = Column E:F
In each list campaigns can appear mutliple times.
In Column A:B I want to sum up the sales per campaign from the two lists using the SUMIF formula:
=SUMIF(C:C,A3,D:D)
=SUMIF(E:E,A3,F:F)
However, the List B should be prioritized over List A which means in case a campaign exists in List B (Column E) the SUMIF function should be only applied to List B and List A should be totally ignored.
The formula might look something like htis:
IF campaign exists in Column E then SUMIF(E:E,A3,F:F) else SUMIF(C:C,A3,D:D)
How can I achieve the desired results in Column B?
Or,
=IF(COUNTIF(E:E,A3)>0,SUMIF(E:E,A3,F:F),SUMIF(C:C,A3,D:D))
I would try with the following:
if(sumIf(E:E,A3,F:F)>0;sumIf(E:E,A3,F:F);sumIf(C:C,A3,D:D))

Find nearest positive and negative value to 0 within a table of values

I have the following Excel spreadsheet:
A B C D E F G
1 Q1 Q2 Q3 Q4 Nearest negative value to 0 -10
2 Asset 1 -50 85 -90 70 Nearest positive value to 0 5
3 Asset 2 -28 -80 -45 60
4 Asset 3 -30 50 55 -10
5 Asset 4 -20 5 -80 -15
6 Asset 5 35 -30 27 -98
7
In Cells A1:E6 I have different assets with their performance from quarter Q1-Q4. The performance can be positive or negative.
In cell G1 and G2 I want to find the nearest negatvie and positive value to 0 in Cells B2:E6. In this case this would -10 and 5. Therefore, I tried to go with the solution here:
G1 = {MAX(IF($B$2:$E$6<0,1,0)*($B$2:$E$6))}
G2 = {MIN(IF($B$2:$E$6>0,1,0)*($B$2:$E$6))}
However, both formulas give me 0 as a result.
Do you have any idea how to solve this issue?
NOTE: All values in Cells B2:E6 are unique.
For largest negative number
=AGGREGATE(15,6,B2:E6/(B2:E6>0),1)
For smallest positive number
=AGGREGATE(14,6,B2:E6/(B2:E6<0),1)
You do not need the *:
=MAX(IF($B$2:$E$6<0,$B$2:$E$6))
And
=MIN(IF($B$2:$E$6>0,$B$2:$E$6))
These are Array formula and need to be confirmed with Ctrl-Shift-Enter.
Along with the AGGREGATE given by Forward Ed if on has Office 365 Excel:
=MAXIFS($B$2:$E$6,$B$2:$E$6,"<"0)
And
=MINIFS($B$2:$E$6,$B$2:$E$6,">"0)

how to change cells color per value next to it

I have the following set of 2 columns and n rows:
A B
1 44000 44000
2 2800 2730
3 17000 21160
4 1000 1046
5 700 0
6 1500 1249
7 300 107
8 1200 400
9 0 1400
10 4500 3582
11 0 280
I would like to create a Conditional Formatting rule for column B, so if value in any row exceeds the associated value in row A the cell becomes red: https://gyazo.com/83a45768c6952f5590448700059179ce
The problem with this approach is I have to modify every single cell and cannot apply the whole Rule for all cells in column B.
If I apply this rule to the set of cells in col A I receive: This type of reference cannot be used in Conditional Formatting formula: http://prntscr.com/feo3c0
The formula:
=$B1>$A1
The Applies to:
=$B:$B

Excel multiple search/match and sum (edit: answered with SUMIFS, COUNTIFS)

I am looking for help to solve this excel problem.
Essentially I want to create a formula for cells in column F which does a multiple search on 3 criteria (on cells in columns A,B,C) and want to access the corresponding column D values where all these (multiple) matches occur, and sum this in column F. I'd also like a count of the amount of matches found to calculate the value in column F; placed alongside in column G.
e.g.
IF col_A_value (anywhere in whole A column) = current_col_A_value +/- 1
AND col_B_value (anywhere in whole B column) = current_col_B_value +/- 1
AND col_C_value (anywhere in whole C column) = current_col_C_value - 1
THEN (output in column F) the sum of all values from row D where this criteria is met
(also, as a seperate but related cell formula, output in column G) the total Count of times this occurs.
Note: the values in columns A,B,C are all integars and the +/- above means to search for any values which are either +1, 0, or -1 different in value. (i.e. this includes the value itself).
e.g. If the value in cell A1 = 10, B1 = 45, C1 = 881, then the first search criteria would look for all other rows with values of 9, 10 or 11 in column A. Then based on these rows, the second search criteria would refine the search to only those rows which also include either a 44, 45 or 46 in column B, and the third search criteria would refine the search again to only include those rows where the column C value is 880.
Next, the values in the column D cells from all of these 'filtered' rows would be summed and the result placed in the column F cell. (The count of these results rows would be put in column G. (seperate formula required))
Since these are all unique entries (think of columns A,B,C creating unique vector coordinates in space), there should be a maximum of 9 entries found and summed. A +/-1: 3 variations, B +/-1: 3 variations and C -1 only: 1 variation. In total: 3x3x1 = 9 unique rows maximum (and potentially none as a minimum, as in the below example).
(If no match is found a value of 0 is good.)
Example with A,B,C,D and E as given values, and column F values calculated (together with the count shown in col G):
A B C D E F G
1 1 1 90 8 0 0
1 2 1 80 6 0 0
1 3 1 70 1 0 0
1 4 1 60 6 0 0
2 1 1 50 1 0 0
2 2 1 40 8 0 0
2 3 1 30 6 0 0
2 4 1 20 8 0 0
3 1 1 10 8 0 0
3 2 1 11 6 0 0
3 3 1 12 1 0 0
3 4 1 13 1 0 0
1 1 2 99 8 260 4
1 2 2 89 6 360 6
1 3 2 79 1 300 6
1 4 2 69 6 180 4
2 1 2 59 1 281 6
2 2 2 49 8 393 9
etc
To illustrate how column F values are calculated here is the working:
260 = 90+80+50+40
360 = 90+80+70+50+40+30
300 = 80+70+60+40+30+20
180 = 70+60+30+20
281 = 90+80+50+40+10+11
393 = 90+80+70+50+40+30+10+11+12
Thanks a lot for any help with this!
These formulas should do what you desire:
F1: =SUMIFS(D:D,A:A,"<="&A1+1,A:A,">="&A1-1,B:B,"<="&B1+1,B:B,">="&B1-1,C:C,C1-1)
G1: =COUNTIFS(A:A,"<="&A1+1,A:A,">="&A1-1,B:B,"<="&B1+1,B:B,">="&B1-1,C:C,C1-1)
The formulas can simply be copied down as you need them...
(Still I don't know what col E is for)

Resources