LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default How do you display IF statement results in a different cell

Neal,

here is a macro that you can use to do what you want. Make sure you select
B5 in sheet1 (you could use any cell really.)

Public Sub InProgress()
' Adds all companies "In progress", at the selected cell.
Dim companyCol As New Collection
Dim progressRange As Range
Dim curCell As Range

' You might want to name the range O3:O102 and use that instead.
Set progressRange = Worksheets("Sheet2").Range("O3:O5")

' Collect all the companies in progress in a collection
For Each curCell In progressRange
' I'm assuming that column A will always contain the company name
' and column O the progress flag.
If curCell.Value = 1 Then
companyCol.Add (curCell.Offset(columnoffset:=-14).Value)
End If
Next

' Now display the collection in the current cell
Dim i As Integer
Dim targetCell As Range

' Selection is the active cell in sheet1, i.e. B5
Set targetCell = Selection
For i = 1 To companyCol.Count
targetCell.Value = companyCol(i)
Set targetCell = targetCell.Offset(rowoffset:=1)
Next
End Sub

To create the macro do the following: press alt+F11, Select Insert | Module
from the menu and copy and paste code below.

HTH.

Cheers,
Socratis

"Neall" wrote:

basically I have a summary sheet which I want to display data of
"current in progress works". On the other worksheet I have the a column that
tells me which company is in progress (100 companies) so what I want to do is;

on worksheet 2 read colum O3 if there is a 1 (meaning in progress) then take
the company name A3 and display it in summary sheet cell B5, the O and A rows
always are the same so if O33 has a 1 A33 is always the company that relates
to that cell, I have seperate IF statements for each row at this point.

Now not all 100 companies will be "in progress" so to avoid a bunch of void
cells under each other I want to put all result in B5 (summary sheet) under
each other so its a clean flowing list

Does that make sense?

Thanks for your help in advance
Neall

--
Neall

 
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
How do you display IF statement results in a different cell Neall Excel Worksheet Functions 7 June 22nd 07 08:53 PM
IF statement colored results matles007 Excel Worksheet Functions 1 May 18th 06 02:29 PM
can I use 2 formulas in 1 cell and display both results chris New Users to Excel 4 March 30th 06 12:26 PM
if/then statement that results in Yes/No Patty via OfficeKB.com Excel Discussion (Misc queries) 3 August 3rd 05 02:26 PM
adding if statement results Robb27 Excel Worksheet Functions 3 November 20th 04 05:27 AM


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