Possible to Create New Records Based on IF Statement?

knotty150

New Member
Joined
Jun 26, 2014
Messages
30
Morning All

Would anyone be able to tell me if it's possible to create another record, for a record based on an IF statement? e.g.:


Sales ID</SPAN>
Sales Person A</SPAN>
Support Sales Person</SPAN>
Amount (£)</SPAN>
456789</SPAN>
Malcolm</SPAN>
Douglas</SPAN>
10</SPAN>

<TBODY>
</TBODY>


I've got data in the above format. I want to produce a table of sales person stats whereby if a record has a "Support Sales Person" (not all of them do), an additional record is create with the "Support Sales Person" listed as the "Sales Person:"


Sales ID</SPAN>
Sales Person A</SPAN>
Support Sales Person</SPAN>
Amount (£)</SPAN>
456789</SPAN>
Douglas</SPAN>

10</SPAN>

<TBODY>
</TBODY>



Reason being is I'd like to be able to include the records with a "Support Sales Person" in the "Sales Person" stats, but then also reflect them separately.

Hope that makes sense!

Thanks

Rich
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
As long as you haven't already made any of the separate mapping tickets it's pretty easy.

Code:
'Imagine table starts at in column A in Startrow and ends in Column D in EndRow
For i = Startrow to EndRow
         If Range("C" & i).Value = "" Then
           'Nothing there, not a problem move on
         Else
           'Support Sales Person Present
           
           'Check if already Present
           If Range("A" & i+1).Value = Range("A" & i).Value Then

           Else 


                      'Insert new row
                      Range("A"&i)[COLOR=#333333].Offset(1).EntireRow.Insert[/COLOR]
                      'Put in Data
                      Range("A" & i+1).Value = Range("A" & i).Value
                      Range("B" & i+1).Value = Range("C" & i).Value
                      Range("D" & i+1).Value = Range("D" & i).Value
                      EndRow = EndRow + 1
             End If
         End If 
Next

Edited a bit :)

Kind Regards,
Chris
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,041
Messages
6,176,035
Members
452,697
Latest member
CuriousSpreadsheet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top