+ Reply to Thread
Results 1 to 9 of 9

Format cell in column B based on value in the next cell (column c)

  1. #1
    Nicole
    Guest

    Format cell in column B based on value in the next cell (column c)

    I did a basic select all from one application & pasted it into Excel
    (starting a cell A1).
    How do I conditionally format Column C based on the value in Column B?

    What I'm looking for is:
    If the row value in Column B = 1, then ident the Column C 1 time.
    If the row value in Column B = 2, then ident the Column C 2 times.
    etc.

    To make things worse:
    the range of data keeps changing (it may be 200 rows one week & 800 rows the
    next).


  2. #2
    JulieD
    Guest

    Re: Format cell in column B based on value in the next cell (column c)

    Hi Nicole

    AFAIK you'll have to use a macro for this as conditional formatting does not
    allow for indents. Is a macro solution acceptable?

    Cheers
    JulieD

    "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    >I did a basic select all from one application & pasted it into Excel
    > (starting a cell A1).
    > How do I conditionally format Column C based on the value in Column B?
    >
    > What I'm looking for is:
    > If the row value in Column B = 1, then ident the Column C 1 time.
    > If the row value in Column B = 2, then ident the Column C 2 times.
    > etc.
    >
    > To make things worse:
    > the range of data keeps changing (it may be 200 rows one week & 800 rows
    > the
    > next).
    >




  3. #3
    Nicole
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    Yes - I macro is an acceptable solution. I just need a little help and
    sample....PLEASE!

    "JulieD" wrote:

    > Hi Nicole
    >
    > AFAIK you'll have to use a macro for this as conditional formatting does not
    > allow for indents. Is a macro solution acceptable?
    >
    > Cheers
    > JulieD
    >
    > "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    > >I did a basic select all from one application & pasted it into Excel
    > > (starting a cell A1).
    > > How do I conditionally format Column C based on the value in Column B?
    > >
    > > What I'm looking for is:
    > > If the row value in Column B = 1, then ident the Column C 1 time.
    > > If the row value in Column B = 2, then ident the Column C 2 times.
    > > etc.
    > >
    > > To make things worse:
    > > the range of data keeps changing (it may be 200 rows one week & 800 rows
    > > the
    > > next).
    > >

    >
    >
    >


  4. #4
    JulieD
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    Hi Nicole

    here's some sample code, it requires you to choose column C and then run the
    macro
    ---
    Sub indentdata()

    For Each cell In Selection
    on error resume next
    cell.InsertIndent cell.Offset(0, -1).Value
    Next

    End Sub
    ---

    to use the code, right mouse click on a worksheet tab and choose view code
    in the VBE window choose insert / module
    copy & paste the code on the right hand of the screen
    use alt & f11 to get back to your workbook
    select column C
    choose tools / macro / macros
    find the indentdata macro
    click run

    Hope this helps
    Cheers
    JulieD



    "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    news:726F5107-E401-4E9D-8608-4BCB6DF7B375@microsoft.com...
    > Yes - I macro is an acceptable solution. I just need a little help and
    > sample....PLEASE!
    >
    > "JulieD" wrote:
    >
    >> Hi Nicole
    >>
    >> AFAIK you'll have to use a macro for this as conditional formatting does
    >> not
    >> allow for indents. Is a macro solution acceptable?
    >>
    >> Cheers
    >> JulieD
    >>
    >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    >> >I did a basic select all from one application & pasted it into Excel
    >> > (starting a cell A1).
    >> > How do I conditionally format Column C based on the value in Column B?
    >> >
    >> > What I'm looking for is:
    >> > If the row value in Column B = 1, then ident the Column C 1 time.
    >> > If the row value in Column B = 2, then ident the Column C 2 times.
    >> > etc.
    >> >
    >> > To make things worse:
    >> > the range of data keeps changing (it may be 200 rows one week & 800
    >> > rows
    >> > the
    >> > next).
    >> >

    >>
    >>
    >>




  5. #5
    Nicole
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    You are AWESOME!!! THANKS SO MUCH.
    I didn't think it would be that easy. Thanks again

    Cheers back at you!
    Nicole

    "JulieD" wrote:

    > Hi Nicole
    >
    > here's some sample code, it requires you to choose column C and then run the
    > macro
    > ---
    > Sub indentdata()
    >
    > For Each cell In Selection
    > on error resume next
    > cell.InsertIndent cell.Offset(0, -1).Value
    > Next
    >
    > End Sub
    > ---
    >
    > to use the code, right mouse click on a worksheet tab and choose view code
    > in the VBE window choose insert / module
    > copy & paste the code on the right hand of the screen
    > use alt & f11 to get back to your workbook
    > select column C
    > choose tools / macro / macros
    > find the indentdata macro
    > click run
    >
    > Hope this helps
    > Cheers
    > JulieD
    >
    >
    >
    > "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > news:726F5107-E401-4E9D-8608-4BCB6DF7B375@microsoft.com...
    > > Yes - I macro is an acceptable solution. I just need a little help and
    > > sample....PLEASE!
    > >
    > > "JulieD" wrote:
    > >
    > >> Hi Nicole
    > >>
    > >> AFAIK you'll have to use a macro for this as conditional formatting does
    > >> not
    > >> allow for indents. Is a macro solution acceptable?
    > >>
    > >> Cheers
    > >> JulieD
    > >>
    > >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > >> news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    > >> >I did a basic select all from one application & pasted it into Excel
    > >> > (starting a cell A1).
    > >> > How do I conditionally format Column C based on the value in Column B?
    > >> >
    > >> > What I'm looking for is:
    > >> > If the row value in Column B = 1, then ident the Column C 1 time.
    > >> > If the row value in Column B = 2, then ident the Column C 2 times.
    > >> > etc.
    > >> >
    > >> > To make things worse:
    > >> > the range of data keeps changing (it may be 200 rows one week & 800
    > >> > rows
    > >> > the
    > >> > next).
    > >> >
    > >>
    > >>
    > >>

    >
    >
    >


  6. #6
    JulieD
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    you're welcome and thanks for the feedback

    "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    news:4ED12C63-E71B-49A2-B7A0-74BB0FFCA183@microsoft.com...
    > You are AWESOME!!! THANKS SO MUCH.
    > I didn't think it would be that easy. Thanks again
    >
    > Cheers back at you!
    > Nicole
    >
    > "JulieD" wrote:
    >
    >> Hi Nicole
    >>
    >> here's some sample code, it requires you to choose column C and then run
    >> the
    >> macro
    >> ---
    >> Sub indentdata()
    >>
    >> For Each cell In Selection
    >> on error resume next
    >> cell.InsertIndent cell.Offset(0, -1).Value
    >> Next
    >>
    >> End Sub
    >> ---
    >>
    >> to use the code, right mouse click on a worksheet tab and choose view
    >> code
    >> in the VBE window choose insert / module
    >> copy & paste the code on the right hand of the screen
    >> use alt & f11 to get back to your workbook
    >> select column C
    >> choose tools / macro / macros
    >> find the indentdata macro
    >> click run
    >>
    >> Hope this helps
    >> Cheers
    >> JulieD
    >>
    >>
    >>
    >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> news:726F5107-E401-4E9D-8608-4BCB6DF7B375@microsoft.com...
    >> > Yes - I macro is an acceptable solution. I just need a little help and
    >> > sample....PLEASE!
    >> >
    >> > "JulieD" wrote:
    >> >
    >> >> Hi Nicole
    >> >>
    >> >> AFAIK you'll have to use a macro for this as conditional formatting
    >> >> does
    >> >> not
    >> >> allow for indents. Is a macro solution acceptable?
    >> >>
    >> >> Cheers
    >> >> JulieD
    >> >>
    >> >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> >> news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    >> >> >I did a basic select all from one application & pasted it into Excel
    >> >> > (starting a cell A1).
    >> >> > How do I conditionally format Column C based on the value in Column
    >> >> > B?
    >> >> >
    >> >> > What I'm looking for is:
    >> >> > If the row value in Column B = 1, then ident the Column C 1 time.
    >> >> > If the row value in Column B = 2, then ident the Column C 2 times.
    >> >> > etc.
    >> >> >
    >> >> > To make things worse:
    >> >> > the range of data keeps changing (it may be 200 rows one week & 800
    >> >> > rows
    >> >> > the
    >> >> > next).
    >> >> >
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>




  7. #7
    LeonB
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    OK. How about this one. I want to conditionally format one cell or a range
    of cells based on the condition or value in a totally different cell or range
    of cells. How would I do that? Like color fill cell C2 yellow if cell H20
    equals Y. And macros are OK. I just don't know the terms or commands I
    would use to program that stuff.

    Thanks to anyone that can help.

    "JulieD" wrote:

    > you're welcome and thanks for the feedback
    >
    > "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > news:4ED12C63-E71B-49A2-B7A0-74BB0FFCA183@microsoft.com...
    > > You are AWESOME!!! THANKS SO MUCH.
    > > I didn't think it would be that easy. Thanks again
    > >
    > > Cheers back at you!
    > > Nicole
    > >
    > > "JulieD" wrote:
    > >
    > >> Hi Nicole
    > >>
    > >> here's some sample code, it requires you to choose column C and then run
    > >> the
    > >> macro
    > >> ---
    > >> Sub indentdata()
    > >>
    > >> For Each cell In Selection
    > >> on error resume next
    > >> cell.InsertIndent cell.Offset(0, -1).Value
    > >> Next
    > >>
    > >> End Sub
    > >> ---
    > >>
    > >> to use the code, right mouse click on a worksheet tab and choose view
    > >> code
    > >> in the VBE window choose insert / module
    > >> copy & paste the code on the right hand of the screen
    > >> use alt & f11 to get back to your workbook
    > >> select column C
    > >> choose tools / macro / macros
    > >> find the indentdata macro
    > >> click run
    > >>
    > >> Hope this helps
    > >> Cheers
    > >> JulieD
    > >>
    > >>
    > >>
    > >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > >> news:726F5107-E401-4E9D-8608-4BCB6DF7B375@microsoft.com...
    > >> > Yes - I macro is an acceptable solution. I just need a little help and
    > >> > sample....PLEASE!
    > >> >
    > >> > "JulieD" wrote:
    > >> >
    > >> >> Hi Nicole
    > >> >>
    > >> >> AFAIK you'll have to use a macro for this as conditional formatting
    > >> >> does
    > >> >> not
    > >> >> allow for indents. Is a macro solution acceptable?
    > >> >>
    > >> >> Cheers
    > >> >> JulieD
    > >> >>
    > >> >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    > >> >> news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    > >> >> >I did a basic select all from one application & pasted it into Excel
    > >> >> > (starting a cell A1).
    > >> >> > How do I conditionally format Column C based on the value in Column
    > >> >> > B?
    > >> >> >
    > >> >> > What I'm looking for is:
    > >> >> > If the row value in Column B = 1, then ident the Column C 1 time.
    > >> >> > If the row value in Column B = 2, then ident the Column C 2 times.
    > >> >> > etc.
    > >> >> >
    > >> >> > To make things worse:
    > >> >> > the range of data keeps changing (it may be 200 rows one week & 800
    > >> >> > rows
    > >> >> > the
    > >> >> > next).
    > >> >> >
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >


  8. #8
    Forum Contributor
    Join Date
    05-04-2005
    Posts
    136
    this will format C based on H of the same row for ten rows
    you can change how many rows in the line For i = 1 to however many you want. this can also be a variable (so you can check how many records you have and assign that to a variable)


    Sub insertcolor()

    Dim i As Integer
    i = 0
    Range("C:C").Select
    Range("C1").Activate

    For i = 1 To 10
    On Error Resume Next
    If ActiveCell.Offset(0, 5) = "Y" Then
    ActiveCell.Interior.ColorIndex = 6
    End If
    ActiveCell.Offset(1, 0).Activate
    Next
    End Sub

  9. #9
    Gord Dibben
    Guest

    Re: Format cell in column B based on value in the next cell (colum

    Leon

    You can use Conditional Formatting to achieve this.

    e.g. select C2 and Format>CF>Formula is: =H20="Y"

    Select Yellow from the Format>Patterns and OK your way out.

    Enter Y in H20 and watch C2 turn yellow.


    Gord Dibben Excel MVP

    On Wed, 18 May 2005 12:52:04 -0700, "LeonB" <LeonB@discussions.microsoft.com>
    wrote:

    >OK. How about this one. I want to conditionally format one cell or a range
    >of cells based on the condition or value in a totally different cell or range
    >of cells. How would I do that? Like color fill cell C2 yellow if cell H20
    >equals Y. And macros are OK. I just don't know the terms or commands I
    >would use to program that stuff.
    >
    >Thanks to anyone that can help.
    >
    >"JulieD" wrote:
    >
    >> you're welcome and thanks for the feedback
    >>
    >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> news:4ED12C63-E71B-49A2-B7A0-74BB0FFCA183@microsoft.com...
    >> > You are AWESOME!!! THANKS SO MUCH.
    >> > I didn't think it would be that easy. Thanks again
    >> >
    >> > Cheers back at you!
    >> > Nicole
    >> >
    >> > "JulieD" wrote:
    >> >
    >> >> Hi Nicole
    >> >>
    >> >> here's some sample code, it requires you to choose column C and then run
    >> >> the
    >> >> macro
    >> >> ---
    >> >> Sub indentdata()
    >> >>
    >> >> For Each cell In Selection
    >> >> on error resume next
    >> >> cell.InsertIndent cell.Offset(0, -1).Value
    >> >> Next
    >> >>
    >> >> End Sub
    >> >> ---
    >> >>
    >> >> to use the code, right mouse click on a worksheet tab and choose view
    >> >> code
    >> >> in the VBE window choose insert / module
    >> >> copy & paste the code on the right hand of the screen
    >> >> use alt & f11 to get back to your workbook
    >> >> select column C
    >> >> choose tools / macro / macros
    >> >> find the indentdata macro
    >> >> click run
    >> >>
    >> >> Hope this helps
    >> >> Cheers
    >> >> JulieD
    >> >>
    >> >>
    >> >>
    >> >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> >> news:726F5107-E401-4E9D-8608-4BCB6DF7B375@microsoft.com...
    >> >> > Yes - I macro is an acceptable solution. I just need a little help and
    >> >> > sample....PLEASE!
    >> >> >
    >> >> > "JulieD" wrote:
    >> >> >
    >> >> >> Hi Nicole
    >> >> >>
    >> >> >> AFAIK you'll have to use a macro for this as conditional formatting
    >> >> >> does
    >> >> >> not
    >> >> >> allow for indents. Is a macro solution acceptable?
    >> >> >>
    >> >> >> Cheers
    >> >> >> JulieD
    >> >> >>
    >> >> >> "Nicole" <Nicole@discussions.microsoft.com> wrote in message
    >> >> >> news:8D81D8BB-DFFD-48A1-BC51-67E5DB519D6E@microsoft.com...
    >> >> >> >I did a basic select all from one application & pasted it into Excel
    >> >> >> > (starting a cell A1).
    >> >> >> > How do I conditionally format Column C based on the value in Column
    >> >> >> > B?
    >> >> >> >
    >> >> >> > What I'm looking for is:
    >> >> >> > If the row value in Column B = 1, then ident the Column C 1 time.
    >> >> >> > If the row value in Column B = 2, then ident the Column C 2 times.
    >> >> >> > etc.
    >> >> >> >
    >> >> >> > To make things worse:
    >> >> >> > the range of data keeps changing (it may be 200 rows one week & 800
    >> >> >> > rows
    >> >> >> > the
    >> >> >> > next).
    >> >> >> >
    >> >> >>
    >> >> >>
    >> >> >>
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1