#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default If Formula

Hi all,

here is the layout of my spreadsheet:

a3=apple
a4=orange
a5=pear

b2=red
c2=green
d2=yellow
e2=blue

b3=1
c4=1
d5=1
e5=1

f3=formula
f4=formula
f5=formula

g3=formula
g4=formula
f4=formula

column f formula: if there is a 1 on b3:e3, give me the color text
column g formula: if there is another 1 on b3:e3, give me the next
color text

thank you in advance!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 265
Default If Formula

Is this what you mean?

F3, copied down:

=IF(ISNUMBER(MATCH(1,B3:E3,0)),INDEX($B$2:$E$2,MAT CH(1,B3:E3,0)),"")

G3, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=IF(COUNTIF(B3:E3,1)1,INDEX($B$2:$E$2,SMALL(IF(B3 :E3=1,COLUMN($B$2:$E$2)
-COLUMN($B$2)+1),2)),"")

--
Domenic
Microsoft Excel MVP
www.xl-central.com
Your Quick Reference to Excel Solutions

In article
,
Redi wrote:

Hi all,

here is the layout of my spreadsheet:

a3=apple
a4=orange
a5=pear

b2=red
c2=green
d2=yellow
e2=blue

b3=1
c4=1
d5=1
e5=1

f3=formula
f4=formula
f5=formula

g3=formula
g4=formula
f4=formula

column f formula: if there is a 1 on b3:e3, give me the color text
column g formula: if there is another 1 on b3:e3, give me the next
color text

thank you in advance!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default If Formula

On Mon, 10 Aug 2009 12:22:59 -0700 (PDT), Redi
wrote:

Hi all,

here is the layout of my spreadsheet:

a3=apple
a4=orange
a5=pear

b2=red
c2=green
d2=yellow
e2=blue

b3=1
c4=1
d5=1
e5=1

f3=formula
f4=formula
f5=formula

g3=formula
g4=formula
f4=formula

column f formula: if there is a 1 on b3:e3, give me the color text
column g formula: if there is another 1 on b3:e3, give me the next
color text

thank you in advance!



Try the following formula in cell F3:

=IF(SUM(B3:E3),INDEX(B$2:E$2,MATCH(1,B3:E3,0)),"")

and the following formula in cell G3:

=IF(SUM(B3:E3)1,INDEX(B$2:E$2,SMALL(IF(B3:E3=1,CO LUMN(B:E)-1),2)),"")

Note: This is an array formula that should be confirmed with
CTRL+SHIFT+ENTER rather than just ENTER.

Copy cells F3:G3 down thru F5:G5

Hope this helps / Lars-Åke

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default If Formula

Thanks guys. they both worked fine. I chose to go with the second one.
thank you for all the time you saved me!
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default If Formula

In F3:
=IF(COUNTIF(B3:E3,1)=0,"",INDEX($B$2:$E$2,1,MATCH( 1,B3:E3,0)))
In G3:
=IF(COUNTIF(B3:E3,1)0,IF(LOOKUP(1,B3:E3,$B$2:$E$2 )<F3,LOOKUP(1,B3:E3,$B$2:$E$2),""),"")

Copy down as needed. (Note that MATCH is looking for first instance of "1",
while LOOKUP" is taking last instance. Thus, this can not be simply expanded
to column H to find a third "1")
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Redi" wrote:

Hi all,

here is the layout of my spreadsheet:

a3=apple
a4=orange
a5=pear

b2=red
c2=green
d2=yellow
e2=blue

b3=1
c4=1
d5=1
e5=1

f3=formula
f4=formula
f5=formula

g3=formula
g4=formula
f4=formula

column f formula: if there is a 1 on b3:e3, give me the color text
column g formula: if there is another 1 on b3:e3, give me the next
color text

thank you in advance!



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default If Formula


Hey Luke M,
can you help me with a formulate that can run into the consecutive
columns H, I, J, K, L and so forth, to find a third, fourth, fifth,
sixth, and so forth... 1.
Thanks in advance.
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default If Formula

On Mon, 17 Aug 2009 09:43:37 -0700 (PDT), Redi
wrote:


Hey Luke M,
can you help me with a formulate that can run into the consecutive
columns H, I, J, K, L and so forth, to find a third, fourth, fifth,
sixth, and so forth... 1.
Thanks in advance.



Well, in order to have more than 4 ones you have to move your result
to the right a bit.

I have generalized the formula you got previously.

First you should name the range with you colors as colors.
(in your small example the range is B2:E2)
Name the first cell of your result as result
(in your small example this range is F3)

The put the following formula in the first cell of your result.

=IF(SUM(OFFSET(colors,SUM(ROW()-ROW(colors)),0))COLUMN()-COLUMN(result),
INDEX(colors,SMALL(IF(OFFSET(colors,SUM(ROW()-ROW(colors)),0)=1,
COLUMN(colors)-1),1+COLUMN()-COLUMN(result))),"")

Note: This is an array formula that should be confirmed with
CTRL+SHIFT+ENTER rather than just ENTER.

Copy to the right as far as the most possible number of ones (colors)
Copy down as far as you have data (matrix of ones under your colors).

Hope this helps / Lars-Åke

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default If Formula

Lars-Åke Aspelin, thanks!
your formula works great with my little example. However, when i try
it with my actual worksheet, the results are not coming out correct.
It is giving me the eight color down from the actual/right color. This
is the case with all results. I am not sure whats causing this. Do you
have any idea?
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default If Formula

On Tue, 18 Aug 2009 07:10:05 -0700 (PDT), Redi
wrote:

Lars-Åke Aspelin, thanks!
your formula works great with my little example. However, when i try
it with my actual worksheet, the results are not coming out correct.
It is giving me the eight color down from the actual/right color. This
is the case with all results. I am not sure whats causing this. Do you
have any idea?



I don't understand what you mean by "the eight color down".
Please give some example from your actual worksheet.
What is the result you get from the formula?
What is the result you expect?

Lars-Åke

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default If Formula

I think that i solved what i was looking to do.

Changed the formula from -1 to -9.


=IF(SUM(OFFSET(colors,SUM(ROW()-ROW(colors)),0))COLUMN()-COLUMN
(result),
INDEX(colors,SMALL(IF(OFFSET(colors,SUM(ROW()-ROW(colors)),0)=1,
COLUMN(colors)-9),1+COLUMN()-COLUMN(result))),"")

Thank you!!!


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



All times are GMT +1. The time now is 08:22 PM.

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"