Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Comparing cells and output text

Hi!

I'm comparing prices of different companies and products.
If I have prices in different cells for each company I can
calculate the lowest price using:

=MIN(A1;B1;C1;D1)

The output is written in E1. How will I have cell F1 write
the company name? Let's say the companies are IBM,
MS, DELL, HP.

If MS has the lowest price I will have the value of B1 in
cell E1 and in cell F1 I will have the text MS.

It is simple to to with an IF statement when you only have
two companies. But what if you have three or more? Is there
a formula to use for a general case with many companies?

I am also curious if it it possible to change the color of cell
F1 depending on the text there? Let's say blue for MS, red
for Dell etc.

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Comparing cells and output text

To return the Company names to column F try the VLOOKUP function.

Debra Dalgleish has goo instructions and a downloadable workbook.

http://www.contextures.on.ca/xlFunctions02.html

For changing cells colors based on cell value........text or numeric see
Conditional Formatting

See also Debra's site at http://www.contextures.on.ca/xlCondFormat01.html for
more on CF


Gord Dibben MS Excel MVP

On Sat, 17 May 2008 13:24:00 -0700, Rocketeer
wrote:

Hi!

I'm comparing prices of different companies and products.
If I have prices in different cells for each company I can
calculate the lowest price using:

=MIN(A1;B1;C1;D1)

The output is written in E1. How will I have cell F1 write
the company name? Let's say the companies are IBM,
MS, DELL, HP.

If MS has the lowest price I will have the value of B1 in
cell E1 and in cell F1 I will have the text MS.

It is simple to to with an IF statement when you only have
two companies. But what if you have three or more? Is there
a formula to use for a general case with many companies?

I am also curious if it it possible to change the color of cell
F1 depending on the text there? Let's say blue for MS, red
for Dell etc.

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Comparing cells and output text

Thanks for the links. Lots of useful information.

/Peter

"Gord Dibben" wrote:

To return the Company names to column F try the VLOOKUP function.

Debra Dalgleish has goo instructions and a downloadable workbook.

http://www.contextures.on.ca/xlFunctions02.html

For changing cells colors based on cell value........text or numeric see
Conditional Formatting

See also Debra's site at http://www.contextures.on.ca/xlCondFormat01.html for
more on CF


Gord Dibben MS Excel MVP

On Sat, 17 May 2008 13:24:00 -0700, Rocketeer
wrote:

Hi!

I'm comparing prices of different companies and products.
If I have prices in different cells for each company I can
calculate the lowest price using:

=MIN(A1;B1;C1;D1)

The output is written in E1. How will I have cell F1 write
the company name? Let's say the companies are IBM,
MS, DELL, HP.

If MS has the lowest price I will have the value of B1 in
cell E1 and in cell F1 I will have the text MS.

It is simple to to with an IF statement when you only have
two companies. But what if you have three or more? Is there
a formula to use for a general case with many companies?

I am also curious if it it possible to change the color of cell
F1 depending on the text there? Let's say blue for MS, red
for Dell etc.

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Comparing cells and output text

Q1:
This might suffice
In E1: =INDEX({"IBM","MS","DELL","HP"},MATCH(MIN(A1:D1),A 1:D1,0))

Q2:
You could use CF for col F, but only up to 3 colours (in xl2003)
Steps would go something like this ..
Select col F (F1 active), click Format Conditional Formatting
Condition 1
Formula Is: =$E1="MS"
Format to taste

Condition 2
Formula Is: =$E1="DELL"
Format to taste

Condition 3
Formula Is: =$E1="IBM"
Format to taste
OK out
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rocketeer" wrote:
I'm comparing prices of different companies and products.
If I have prices in different cells for each company I can
calculate the lowest price using:

=MIN(A1;B1;C1;D1)

The output is written in E1. How will I have cell F1 write
the company name? Let's say the companies are IBM,
MS, DELL, HP.

If MS has the lowest price I will have the value of B1 in
cell E1 and in cell F1 I will have the text MS.

It is simple to to with an IF statement when you only have
two companies. But what if you have three or more? Is there
a formula to use for a general case with many companies?

I am also curious if it it possible to change the color of cell
F1 depending on the text there? Let's say blue for MS, red
for Dell etc.

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Comparing cells and output text

Hi Max!

I can see were you want to go with the formulas. I'm having trouble
with the MATCH function. Lets say I don't have data in A1:D1 but
rather in F2, J2, N2 and R2.

=MATCH(MIN(F2;J2;N2;R2);(F2;J2;N2;R2);0)

But this outputs a #N/A in the target cell V2. Do you have any
suggestions?

Thanks!


"Max" wrote:

Q1:
This might suffice
In E1: =INDEX({"IBM","MS","DELL","HP"},MATCH(MIN(A1:D1),A 1:D1,0))

Q2:
You could use CF for col F, but only up to 3 colours (in xl2003)
Steps would go something like this ..
Select col F (F1 active), click Format Conditional Formatting
Condition 1
Formula Is: =$E1="MS"
Format to taste

Condition 2
Formula Is: =$E1="DELL"
Format to taste

Condition 3
Formula Is: =$E1="IBM"
Format to taste
OK out
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rocketeer" wrote:
I'm comparing prices of different companies and products.
If I have prices in different cells for each company I can
calculate the lowest price using:

=MIN(A1;B1;C1;D1)

The output is written in E1. How will I have cell F1 write
the company name? Let's say the companies are IBM,
MS, DELL, HP.

If MS has the lowest price I will have the value of B1 in
cell E1 and in cell F1 I will have the text MS.

It is simple to to with an IF statement when you only have
two companies. But what if you have three or more? Is there
a formula to use for a general case with many companies?

I am also curious if it it possible to change the color of cell
F1 depending on the text there? Let's say blue for MS, red
for Dell etc.

Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Comparing cells and output text

You need to pull it into a contiguous range,
eg using simple link formulas such as these:

in S2: =IF(F2="","",F2)
in T2: =IF(J2="","",J2)
in U2: =IF(N2="","",N2)
in V2: =IF(R2="","",R2)

Then, you could place in W2:
=INDEX({"IBM","MS","DELL","HP"},MATCH(MIN(S2:V2),S 2:V2,0))

Note that in the event of any ties in the minimum values,
W2 will return only the 1st match from the left

(amend the commas to semicolons to suit your settings)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rocketeer" wrote:
Hi Max!

I can see were you want to go with the formulas. I'm having trouble
with the MATCH function. Lets say I don't have data in A1:D1 but
rather in F2, J2, N2 and R2.

=MATCH(MIN(F2;J2;N2;R2);(F2;J2;N2;R2);0)

But this outputs a #N/A in the target cell V2. Do you have any
suggestions?

Thanks!


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Comparing cells and output text

Hi!

Now it works like a charm. Thanks for your help.

/Peter

"Max" wrote:

You need to pull it into a contiguous range,
eg using simple link formulas such as these:

in S2: =IF(F2="","",F2)
in T2: =IF(J2="","",J2)
in U2: =IF(N2="","",N2)
in V2: =IF(R2="","",R2)

Then, you could place in W2:
=INDEX({"IBM","MS","DELL","HP"},MATCH(MIN(S2:V2),S 2:V2,0))

Note that in the event of any ties in the minimum values,
W2 will return only the 1st match from the left

(amend the commas to semicolons to suit your settings)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rocketeer" wrote:
Hi Max!

I can see were you want to go with the formulas. I'm having trouble
with the MATCH function. Lets say I don't have data in A1:D1 but
rather in F2, J2, N2 and R2.

=MATCH(MIN(F2;J2;N2;R2);(F2;J2;N2;R2);0)

But this outputs a #N/A in the target cell V2. Do you have any
suggestions?

Thanks!


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Comparing cells and output text

Glad it did. Welcome.
Do take a moment to press the "Yes" button below ...
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rocketeer" wrote:
Now it works like a charm. Thanks for your help.

/Peter


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing data in 2 cells to create an output for a 3rd cell [email protected] Excel Worksheet Functions 2 November 5th 07 11:51 AM
Comparing cells with text Mortir Excel Worksheet Functions 4 January 3rd 07 10:54 PM
comparing text cells Comander Excel Worksheet Functions 2 June 5th 06 10:00 PM
Comparing text strings in cells Andy Excel Discussion (Misc queries) 0 December 7th 05 04:17 PM
Referencing cells text output if it meets specific conditions Chersie Excel Worksheet Functions 3 April 18th 05 04:34 PM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"