Compare values between rows

Rosadocc

New Member
Joined
Mar 15, 2012
Messages
49
Hi,

Im looking to compare the price of items in a spreadsheet.

In the example below, Im looking for a function for the Higher or Lower column that compares Item ID "1" with itself and identifies which is the higher and lower price of the two.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Item ID
[/TD]
[TD]Price[/TD]
[TD]Higher or Lower[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]10.00
[/TD]
[TD]Lower[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]54.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]23.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]14.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]78.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]41.00[/TD]
[TD]Higher[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]74.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]33.00[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Copy C2 down. Note this is an array formula: confirm with ctrl+shift+enter.
Excel Workbook
ABC
1Item IDPriceHigher or Lower
2110Lower
3454Lower
4323Lower
5214Lower
6478Higher
7141Higher
8274Higher
9333Higher
A
 
Upvote 0
Copy C2 down. Note this is an array formula: confirm with ctrl+shift+enter.
A

ABC
Item IDPriceHigher or Lower
Lower
Lower
Lower
Lower
Higher
Higher
Higher
Higher

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:106px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]54[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]23[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]14[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]78[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]41[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]74[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]33[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
C2{=IF(COUNTIF($A$2:$A$9,A2)<2,"",IF(MAX(IF($A$2:$A$9=A2,$B$2:$B$9))=B2,"Higher","Lower"))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


Worked Great!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top