Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Creating a Flag based on cell value

Hello. I'm trying to create a Function based on the cell values within a
range to create a flag (1 - on or 0 - off) in another.

The problem is the same value when it repeats has to have a different
flag value. For example

Range-x Range--y
Key ----- 1
Hello ------- 1
Bye -------- 1
Key -------- 0
Yes -------- 0
No --------- 0
Key -------- 1
This -------- 1
That -------- 1
Key -------- 0
Fix -------- 0

So the flag needs to alternate designation off of a particular value
when it appears in the range and alternate in groups.

When it first appears, everything underneath it is a "1". When it
appears again as a trigger, everything underneath it is a "0" until it
appears again, and so on. I hope this makes sense.

Any help here would be greatly appreciated.

Thanks

Dan

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Creating a Flag based on cell value

You shouldn't need a UDF for that. Try this formula and drag down:

=IF(MOD(SUM(($A$5:A5="Key")*1),2)=1,"Yes","No")

It is an array formula so be sure to use ctrl shift enter.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Creating a Flag based on cell value

in cell Y1
=MOD(COUNTIF($X$1:X1,"Key"),2)

then drag fill down the column

would also work.

--
Regards,
Tom Ogilvy

"Brian Taylor" wrote:

You shouldn't need a UDF for that. Try this formula and drag down:

=IF(MOD(SUM(($A$5:A5="Key")*1),2)=1,"Yes","No")

It is an array formula so be sure to use ctrl shift enter.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Creating a Flag based on cell value

I've been out done! Nicely done Tom. I guess I get stuck on array
formulas sometimes. Better to avoid them if you can.

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
Creating .txt files based on cell contents Matt Bennette[_2_] Excel Discussion (Misc queries) 4 January 5th 09 04:17 PM
Creating reports based on data in a cell LoriKLynn Excel Worksheet Functions 1 August 21st 07 02:52 PM
Creating a conditional format for a cell based on another cell's v steve-o Excel Discussion (Misc queries) 2 October 26th 05 03:51 PM
need help creating formula based on cell value Brad Excel Discussion (Misc queries) 3 April 1st 05 07:51 PM
Creating a worksheet with values based on a control cell Dan Eames Excel Programming 3 July 13th 04 01:45 PM


All times are GMT +1. The time now is 03: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"